| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 6 #define CONTENT_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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/process.h" | 13 #include "base/process.h" |
| 14 #include "content/browser/appcache/appcache_frontend_proxy.h" | 14 #include "content/browser/appcache/appcache_frontend_proxy.h" |
| 15 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
| 16 #include "webkit/appcache/appcache_backend_impl.h" | 16 #include "webkit/appcache/appcache_backend_impl.h" |
| 17 | 17 |
| 18 class ChromeAppCacheService; | 18 class ChromeAppCacheService; |
| 19 | 19 |
| 20 // Handles appcache related messages sent to the main browser process from | 20 // Handles appcache related messages sent to the main browser process from |
| 21 // its child processes. There is a distinct host for each child process. | 21 // its child processes. There is a distinct host for each child process. |
| 22 // Messages are handled on the IO thread. The BrowserRenderProcessHost and | 22 // Messages are handled on the IO thread. The BrowserRenderProcessHost and |
| 23 // WorkerProcessHost create an instance and delegates calls to it. | 23 // WorkerProcessHost create an instance and delegates calls to it. |
| 24 class AppCacheDispatcherHost : public content::BrowserMessageFilter { | 24 class AppCacheDispatcherHost : public content::BrowserMessageFilter { |
| 25 public: | 25 public: |
| 26 AppCacheDispatcherHost(ChromeAppCacheService* appcache_service, | 26 AppCacheDispatcherHost(ChromeAppCacheService* appcache_service, |
| 27 int process_id); | 27 int process_id); |
| 28 virtual ~AppCacheDispatcherHost(); | |
| 29 | 28 |
| 30 // BrowserIOMessageFilter implementation | 29 // BrowserIOMessageFilter implementation |
| 31 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 30 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 32 virtual bool OnMessageReceived(const IPC::Message& message, | 31 virtual bool OnMessageReceived(const IPC::Message& message, |
| 33 bool* message_was_ok) OVERRIDE; | 32 bool* message_was_ok) OVERRIDE; |
| 34 | 33 |
| 35 private: | 34 protected: |
| 35 virtual ~AppCacheDispatcherHost(); |
| 36 |
| 36 // content::BrowserMessageFilter override. | 37 // content::BrowserMessageFilter override. |
| 37 virtual void BadMessageReceived() OVERRIDE; | 38 virtual void BadMessageReceived() OVERRIDE; |
| 38 | 39 |
| 40 private: |
| 39 // IPC message handlers | 41 // IPC message handlers |
| 40 void OnRegisterHost(int host_id); | 42 void OnRegisterHost(int host_id); |
| 41 void OnUnregisterHost(int host_id); | 43 void OnUnregisterHost(int host_id); |
| 42 void OnSetSpawningHostId(int host_id, int spawning_host_id); | 44 void OnSetSpawningHostId(int host_id, int spawning_host_id); |
| 43 void OnSelectCache(int host_id, const GURL& document_url, | 45 void OnSelectCache(int host_id, const GURL& document_url, |
| 44 int64 cache_document_was_loaded_from, | 46 int64 cache_document_was_loaded_from, |
| 45 const GURL& opt_manifest_url); | 47 const GURL& opt_manifest_url); |
| 46 void OnSelectCacheForWorker(int host_id, int parent_process_id, | 48 void OnSelectCacheForWorker(int host_id, int parent_process_id, |
| 47 int parent_host_id); | 49 int parent_host_id); |
| 48 void OnSelectCacheForSharedWorker(int host_id, int64 appcache_id); | 50 void OnSelectCacheForSharedWorker(int host_id, int64 appcache_id); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 appcache::SwapCacheCallback swap_cache_callback_; | 70 appcache::SwapCacheCallback swap_cache_callback_; |
| 69 scoped_ptr<IPC::Message> pending_reply_msg_; | 71 scoped_ptr<IPC::Message> pending_reply_msg_; |
| 70 | 72 |
| 71 // The corresponding ChildProcessHost object's id(). | 73 // The corresponding ChildProcessHost object's id(). |
| 72 int process_id_; | 74 int process_id_; |
| 73 | 75 |
| 74 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); | 76 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 79 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| OLD | NEW |