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 | 12 |
13 namespace IPC { | 13 namespace IPC { |
14 class Message; | 14 class Message; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class DomStorageCachedArea; | 19 class DOMStorageCachedArea; |
20 | 20 |
21 // Dispatches DomStorage related messages sent to a renderer process from the | 21 // Dispatches DomStorage related messages sent to a renderer process from the |
22 // main browser process. There is one instance per child process. Messages | 22 // main browser process. There is one instance per child process. Messages |
23 // are dispatched on the main renderer thread. The RenderThreadImpl | 23 // are dispatched on the main renderer thread. The RenderThreadImpl |
24 // 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 |
25 // the collection of DomStorageCachedAreas that are active in the process. | 25 // the collection of DOMStorageCachedAreas that are active in the process. |
26 class DomStorageDispatcher { | 26 class DomStorageDispatcher { |
27 public: | 27 public: |
28 DomStorageDispatcher(); | 28 DomStorageDispatcher(); |
29 ~DomStorageDispatcher(); | 29 ~DomStorageDispatcher(); |
30 | 30 |
31 // 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. |
32 scoped_refptr<DomStorageCachedArea> OpenCachedArea(int connection_id, | 32 scoped_refptr<DOMStorageCachedArea> OpenCachedArea(int connection_id, |
33 int64 namespace_id, | 33 int64 namespace_id, |
34 const GURL& origin); | 34 const GURL& origin); |
35 void CloseCachedArea(int connection_id, DomStorageCachedArea* area); | 35 void CloseCachedArea(int connection_id, DOMStorageCachedArea* area); |
36 | 36 |
37 bool OnMessageReceived(const IPC::Message& msg); | 37 bool OnMessageReceived(const IPC::Message& msg); |
38 | 38 |
39 private: | 39 private: |
40 class ProxyImpl; | 40 class ProxyImpl; |
41 | 41 |
42 // IPC message handlers | 42 // IPC message handlers |
43 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); | 43 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); |
44 void OnAsyncOperationComplete(bool success); | 44 void OnAsyncOperationComplete(bool success); |
45 | 45 |
46 scoped_refptr<ProxyImpl> proxy_; | 46 scoped_refptr<ProxyImpl> proxy_; |
47 }; | 47 }; |
48 | 48 |
49 } // namespace content | 49 } // namespace content |
50 | 50 |
51 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 51 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
OLD | NEW |