OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 5 #ifndef CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
6 #define CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 6 #define CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/process.h" | 11 #include "base/process.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/appcache/appcache_frontend_proxy.h" | 14 #include "chrome/browser/appcache/appcache_frontend_proxy.h" |
15 #include "chrome/browser/browser_io_message_filter.h" | 15 #include "chrome/browser/browser_message_filter.h" |
16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
18 #include "webkit/appcache/appcache_backend_impl.h" | 18 #include "webkit/appcache/appcache_backend_impl.h" |
19 | 19 |
20 class ChromeAppCacheService; | 20 class ChromeAppCacheService; |
21 class URLRequestContext; | 21 class URLRequestContext; |
22 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
23 | 23 |
24 // Handles appcache related messages sent to the main browser process from | 24 // Handles appcache related messages sent to the main browser process from |
25 // its child processes. There is a distinct host for each child process. | 25 // its child processes. There is a distinct host for each child process. |
26 // Messages are handled on the IO thread. The ResourceMessageFilter and | 26 // Messages are handled on the IO thread. The ResourceMessageFilter and |
27 // WorkerProcessHost create an instance and delegates calls to it. | 27 // WorkerProcessHost create an instance and delegates calls to it. |
28 class AppCacheDispatcherHost : public BrowserIOMessageFilter { | 28 class AppCacheDispatcherHost : public BrowserMessageFilter { |
29 public: | 29 public: |
30 // Constructor for use on the IO thread. | 30 // Constructor for use on the IO thread. |
31 AppCacheDispatcherHost(URLRequestContext* request_context, | 31 AppCacheDispatcherHost(URLRequestContext* request_context, |
32 int process_id); | 32 int process_id); |
33 | 33 |
34 // Constructor for use on the UI thread. | 34 // Constructor for use on the UI thread. |
35 AppCacheDispatcherHost(URLRequestContextGetter* request_context_getter, | 35 AppCacheDispatcherHost(URLRequestContextGetter* request_context_getter, |
36 int process_id); | 36 int process_id); |
37 | 37 |
38 ~AppCacheDispatcherHost(); | 38 ~AppCacheDispatcherHost(); |
39 | 39 |
40 // BrowserIOMessageFilter implementation | 40 // BrowserIOMessageFilter implementation |
41 virtual bool OnMessageReceived(const IPC::Message& message); | |
42 virtual void OnChannelConnected(int32 peer_pid); | 41 virtual void OnChannelConnected(int32 peer_pid); |
| 42 virtual bool OnMessageReceived(const IPC::Message& message, |
| 43 bool* message_was_ok); |
43 | 44 |
44 private: | 45 private: |
45 // IPC message handlers | 46 // IPC message handlers |
46 void OnRegisterHost(int host_id); | 47 void OnRegisterHost(int host_id); |
47 void OnUnregisterHost(int host_id); | 48 void OnUnregisterHost(int host_id); |
48 void OnSelectCache(int host_id, const GURL& document_url, | 49 void OnSelectCache(int host_id, const GURL& document_url, |
49 int64 cache_document_was_loaded_from, | 50 int64 cache_document_was_loaded_from, |
50 const GURL& opt_manifest_url); | 51 const GURL& opt_manifest_url); |
51 void OnSelectCacheForWorker(int host_id, int parent_process_id, | 52 void OnSelectCacheForWorker(int host_id, int parent_process_id, |
52 int parent_host_id); | 53 int parent_host_id); |
(...skipping 28 matching lines...) Expand all Loading... |
81 scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; | 82 scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; |
82 scoped_ptr<IPC::Message> pending_reply_msg_; | 83 scoped_ptr<IPC::Message> pending_reply_msg_; |
83 | 84 |
84 // The corresponding ChildProcessHost object's id(). | 85 // The corresponding ChildProcessHost object's id(). |
85 int process_id_; | 86 int process_id_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); | 88 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); |
88 }; | 89 }; |
89 | 90 |
90 #endif // CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 91 #endif // CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
OLD | NEW |