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