| 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 "ipc/ipc_channel.h" | 9 #include "base/memory/ref_counted.h" |
| 10 | 10 |
| 11 class GURL; |
| 11 struct DOMStorageMsg_Event_Params; | 12 struct DOMStorageMsg_Event_Params; |
| 13 namespace dom_storage { |
| 14 class DomStorageCachedArea; |
| 15 } |
| 16 namespace IPC { |
| 17 class Message; |
| 18 } |
| 12 | 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 |
| 17 class DomStorageDispatcher : public IPC::Channel::Listener { | 24 // the collection of DomStorageCachedAreas that are active in the process. |
| 25 class DomStorageDispatcher { |
| 18 public: | 26 public: |
| 19 DomStorageDispatcher() {} | 27 DomStorageDispatcher(); |
| 28 ~DomStorageDispatcher(); |
| 20 | 29 |
| 21 // IPC::Channel::Listener implementation | 30 // Each call to open should be balanced with a call to close. |
| 22 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 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); |
| 35 |
| 36 bool OnMessageReceived(const IPC::Message& msg); |
| 23 | 37 |
| 24 private: | 38 private: |
| 39 class ProxyImpl; |
| 40 |
| 25 // IPC message handlers | 41 // IPC message handlers |
| 26 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); | 42 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); |
| 43 void OnAsyncOperationComplete(bool success); |
| 44 |
| 45 scoped_refptr<ProxyImpl> proxy_; |
| 27 }; | 46 }; |
| 28 | 47 |
| 29 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 48 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
| OLD | NEW |