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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_
6 #define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_
8 #include "base/memory/ref_counted.h"
11 struct DOMStorageMsg_Event_Params;
19 class DOMStorageCachedArea;
21 // Dispatches DomStorage related messages sent to a renderer process from the
22 // main browser process. There is one instance per child process. Messages
23 // are dispatched on the main renderer thread. The RenderThreadImpl
24 // creates an instance and delegates calls to it. This classes also manages
25 // the collection of DOMStorageCachedAreas that are active in the process.
26 class DomStorageDispatcher {
28 DomStorageDispatcher();
29 ~DomStorageDispatcher();
31 // Each call to open should be balanced with a call to close.
32 scoped_refptr<DOMStorageCachedArea> OpenCachedArea(int connection_id,
35 void CloseCachedArea(int connection_id, DOMStorageCachedArea* area);
37 bool OnMessageReceived(const IPC::Message& msg);
42 // IPC message handlers
43 void OnStorageEvent(const DOMStorageMsg_Event_Params& params);
44 void OnAsyncOperationComplete(bool success);
46 scoped_refptr<ProxyImpl> proxy_;
49 } // namespace content
51 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_