#ifndef CONTENT_CHILD_APPCACHE_APPCACHE_DISPATCHER_H_
#define CONTENT_CHILD_APPCACHE_APPCACHE_DISPATCHER_H_
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "content/child/appcache/appcache_backend_proxy.h"
#include "ipc/ipc_listener.h"
#include "webkit/common/appcache/appcache_interfaces.h"
namespace content {
class AppCacheDispatcher : public IPC::Listener {
 public:
  AppCacheDispatcher(IPC::Sender* sender,
                     appcache::AppCacheFrontend* frontend);
  virtual ~AppCacheDispatcher();
  AppCacheBackendProxy* backend_proxy() { return &backend_proxy_; }
  
  virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
 private:
  
  void OnCacheSelected(int host_id, const appcache::AppCacheInfo& info);
  void OnStatusChanged(const std::vector<int>& host_ids,
                       appcache::Status status);
  void OnEventRaised(const std::vector<int>& host_ids,
                     appcache::EventID event_id);
  void OnProgressEventRaised(const std::vector<int>& host_ids,
                             const GURL& url, int num_total, int num_complete);
  void OnErrorEventRaised(const std::vector<int>& host_ids,
                          const appcache::ErrorDetails& details);
  void OnLogMessage(int host_id, int log_level, const std::string& message);
  void OnContentBlocked(int host_id, const GURL& manifest_url);
  AppCacheBackendProxy backend_proxy_;
  scoped_ptr<appcache::AppCacheFrontend> frontend_;
};
}  
#endif