Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / dom_storage / dom_storage_dispatcher.h
blob70595ca12fdde1c59ca21e71044c7bc74b59baac
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"
10 class GURL;
11 struct DOMStorageMsg_Event_Params;
13 namespace IPC {
14 class Message;
17 namespace content {
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 {
27 public:
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,
33 int64 namespace_id,
34 const GURL& origin);
35 void CloseCachedArea(int connection_id, DOMStorageCachedArea* area);
37 bool OnMessageReceived(const IPC::Message& msg);
39 private:
40 class ProxyImpl;
42 // IPC message handlers
43 void OnStorageEvent(const DOMStorageMsg_Event_Params& params);
44 void OnAsyncOperationComplete(bool success);
45 void OnResetCachedValues(int64 namespace_id);
47 scoped_refptr<ProxyImpl> proxy_;
50 } // namespace content
52 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_