OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_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 URLRequestContextGetter; |
| 22 |
| 23 namespace net { |
21 class URLRequestContext; | 24 class URLRequestContext; |
22 class URLRequestContextGetter; | 25 } // namespace net |
23 | 26 |
24 // Handles appcache related messages sent to the main browser process from | 27 // Handles appcache related messages sent to the main browser process from |
25 // its child processes. There is a distinct host for each child process. | 28 // its child processes. There is a distinct host for each child process. |
26 // Messages are handled on the IO thread. The BrowserRenderProcessHost and | 29 // Messages are handled on the IO thread. The BrowserRenderProcessHost and |
27 // WorkerProcessHost create an instance and delegates calls to it. | 30 // WorkerProcessHost create an instance and delegates calls to it. |
28 class AppCacheDispatcherHost : public BrowserMessageFilter { | 31 class AppCacheDispatcherHost : public BrowserMessageFilter { |
29 public: | 32 public: |
30 // Constructor for use on the IO thread. | 33 // Constructor for use on the IO thread. |
31 AppCacheDispatcherHost(URLRequestContext* request_context, | 34 AppCacheDispatcherHost(net::URLRequestContext* request_context, |
32 int process_id); | 35 int process_id); |
33 | 36 |
34 // Constructor for use on the UI thread. | 37 // Constructor for use on the UI thread. |
35 AppCacheDispatcherHost(URLRequestContextGetter* request_context_getter, | 38 AppCacheDispatcherHost(URLRequestContextGetter* request_context_getter, |
36 int process_id); | 39 int process_id); |
37 | 40 |
38 ~AppCacheDispatcherHost(); | 41 ~AppCacheDispatcherHost(); |
39 | 42 |
40 // BrowserIOMessageFilter implementation | 43 // BrowserIOMessageFilter implementation |
41 virtual void OnChannelConnected(int32 peer_pid); | 44 virtual void OnChannelConnected(int32 peer_pid); |
(...skipping 28 matching lines...) Expand all Loading... |
70 // This is only valid once Initialize() has been called. This MUST be defined | 73 // This is only valid once Initialize() has been called. This MUST be defined |
71 // before backend_impl_ since the latter maintains a (non-refcounted) pointer | 74 // before backend_impl_ since the latter maintains a (non-refcounted) pointer |
72 // to it. | 75 // to it. |
73 scoped_refptr<ChromeAppCacheService> appcache_service_; | 76 scoped_refptr<ChromeAppCacheService> appcache_service_; |
74 | 77 |
75 AppCacheFrontendProxy frontend_proxy_; | 78 AppCacheFrontendProxy frontend_proxy_; |
76 appcache::AppCacheBackendImpl backend_impl_; | 79 appcache::AppCacheBackendImpl backend_impl_; |
77 | 80 |
78 // Temporary until OnChannelConnected() can be called from the IO thread, | 81 // Temporary until OnChannelConnected() can be called from the IO thread, |
79 // which will extract the AppCacheService from the URLRequestContext. | 82 // which will extract the AppCacheService from the URLRequestContext. |
80 scoped_refptr<URLRequestContext> request_context_; | 83 scoped_refptr<net::URLRequestContext> request_context_; |
81 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 84 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
82 | 85 |
83 scoped_ptr<appcache::GetStatusCallback> get_status_callback_; | 86 scoped_ptr<appcache::GetStatusCallback> get_status_callback_; |
84 scoped_ptr<appcache::StartUpdateCallback> start_update_callback_; | 87 scoped_ptr<appcache::StartUpdateCallback> start_update_callback_; |
85 scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; | 88 scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; |
86 scoped_ptr<IPC::Message> pending_reply_msg_; | 89 scoped_ptr<IPC::Message> pending_reply_msg_; |
87 | 90 |
88 // The corresponding ChildProcessHost object's id(). | 91 // The corresponding ChildProcessHost object's id(). |
89 int process_id_; | 92 int process_id_; |
90 | 93 |
91 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); | 94 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); |
92 }; | 95 }; |
93 | 96 |
94 #endif // CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 97 #endif // CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
OLD | NEW |