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_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 | 9 |
10 class GURL; | 10 class GURL; |
11 struct DOMStorageMsg_Event_Params; | 11 struct DOMStorageMsg_Event_Params; |
12 namespace dom_storage { | 12 namespace dom_storage { |
13 class DomStorageCachedArea; | 13 class DomStorageCachedArea; |
14 } | 14 } |
15 namespace IPC { | 15 namespace IPC { |
16 class Message; | 16 class Message; |
17 } | 17 } |
18 | 18 |
| 19 namespace content { |
| 20 |
19 // Dispatches DomStorage related messages sent to a renderer process from the | 21 // Dispatches DomStorage related messages sent to a renderer process from the |
20 // main browser process. There is one instance per child process. Messages | 22 // main browser process. There is one instance per child process. Messages |
21 // are dispatched on the main renderer thread. The RenderThreadImpl | 23 // are dispatched on the main renderer thread. The RenderThreadImpl |
22 // creates an instance and delegates calls to it. This classes also manages | 24 // creates an instance and delegates calls to it. This classes also manages |
23 // the collection of DomStorageCachedAreas that are active in the process. | 25 // the collection of DomStorageCachedAreas that are active in the process. |
24 class DomStorageDispatcher { | 26 class DomStorageDispatcher { |
25 public: | 27 public: |
26 DomStorageDispatcher(); | 28 DomStorageDispatcher(); |
27 ~DomStorageDispatcher(); | 29 ~DomStorageDispatcher(); |
28 | 30 |
29 // Each call to open should be balanced with a call to close. | 31 // Each call to open should be balanced with a call to close. |
30 scoped_refptr<dom_storage::DomStorageCachedArea> OpenCachedArea( | 32 scoped_refptr<dom_storage::DomStorageCachedArea> OpenCachedArea( |
31 int connection_id, int64 namespace_id, const GURL& origin); | 33 int connection_id, int64 namespace_id, const GURL& origin); |
32 void CloseCachedArea( | 34 void CloseCachedArea( |
33 int connection_id, dom_storage::DomStorageCachedArea* area); | 35 int connection_id, dom_storage::DomStorageCachedArea* area); |
34 | 36 |
35 bool OnMessageReceived(const IPC::Message& msg); | 37 bool OnMessageReceived(const IPC::Message& msg); |
36 | 38 |
37 private: | 39 private: |
38 class ProxyImpl; | 40 class ProxyImpl; |
39 | 41 |
40 // IPC message handlers | 42 // IPC message handlers |
41 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); | 43 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); |
42 void OnAsyncOperationComplete(bool success); | 44 void OnAsyncOperationComplete(bool success); |
43 | 45 |
44 scoped_refptr<ProxyImpl> proxy_; | 46 scoped_refptr<ProxyImpl> proxy_; |
45 }; | 47 }; |
46 | 48 |
| 49 } // namespace content |
| 50 |
47 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 51 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
OLD | NEW |