1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_APPCACHE_APPCACHE_DISPATCHER_H_
6 #define CONTENT_COMMON_APPCACHE_APPCACHE_DISPATCHER_H_
11 #include "content/common/appcache/appcache_backend_proxy.h"
12 #include "ipc/ipc_listener.h"
13 #include "webkit/appcache/appcache_frontend_impl.h"
17 // Dispatches appcache related messages sent to a child process from the
18 // main browser process. There is one instance per child process. Messages
19 // are dispatched on the main child thread. The ChildThread base class
20 // creates an instance and delegates calls to it.
21 class AppCacheDispatcher
: public IPC::Listener
{
23 explicit AppCacheDispatcher(IPC::Sender
* sender
) : backend_proxy_(sender
) {}
25 AppCacheBackendProxy
* backend_proxy() { return &backend_proxy_
; }
27 // IPC::Listener implementation
28 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
31 // Ipc message handlers
32 void OnCacheSelected(int host_id
, const appcache::AppCacheInfo
& info
);
33 void OnStatusChanged(const std::vector
<int>& host_ids
,
34 appcache::Status status
);
35 void OnEventRaised(const std::vector
<int>& host_ids
,
36 appcache::EventID event_id
);
37 void OnProgressEventRaised(const std::vector
<int>& host_ids
,
38 const GURL
& url
, int num_total
, int num_complete
);
39 void OnErrorEventRaised(const std::vector
<int>& host_ids
,
40 const std::string
& message
);
41 void OnLogMessage(int host_id
, int log_level
, const std::string
& message
);
42 void OnContentBlocked(int host_id
,
43 const GURL
& manifest_url
);
45 AppCacheBackendProxy backend_proxy_
;
46 appcache::AppCacheFrontendImpl frontend_impl_
;
49 } // namespace content
51 #endif // CONTENT_COMMON_APPCACHE_APPCACHE_DISPATCHER_H_