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