Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: chrome/browser/in_process_webkit/dom_storage_area.h

Issue 5722003: Make DOMStorageDispatcherHost be a message filter (and rename it accordingly)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: get rid of _DELAY_HANDLE macro Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/nullable_string16.h" 10 #include "base/nullable_string16.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/common/dom_storage_common.h" 14 #include "chrome/common/dom_storage_common.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
17 17
18 class DOMStorageDispatcherHost;
19 class DOMStorageNamespace; 18 class DOMStorageNamespace;
20 class HostContentSettingsMap; 19 class HostContentSettingsMap;
21 20
22 // Only use on the WebKit thread. DOMStorageNamespace manages our registration 21 // Only use on the WebKit thread. DOMStorageNamespace manages our registration
23 // with DOMStorageContext. 22 // with DOMStorageContext.
24 class DOMStorageArea { 23 class DOMStorageArea {
25 public: 24 public:
26 DOMStorageArea(const string16& origin, 25 DOMStorageArea(const string16& origin,
27 int64 id, 26 int64 id,
28 DOMStorageNamespace* owner, 27 DOMStorageNamespace* owner,
29 HostContentSettingsMap* host_content_settings_map); 28 HostContentSettingsMap* host_content_settings_map);
30 ~DOMStorageArea(); 29 ~DOMStorageArea();
31 30
32 unsigned Length(); 31 unsigned Length();
33 NullableString16 Key(unsigned index); 32 NullableString16 Key(unsigned index);
34 NullableString16 GetItem(const string16& key); 33 NullableString16 GetItem(const string16& key);
35 // The DOMStorageDispatcherHost parameter is required in case we get a
36 // CONTENT_SETTING_ASK response from the HostContentettingsMap. If we do,
37 // we'll need to let the renderer know that it'll need to run a nested message
38 // loop.
39 NullableString16 SetItem( 34 NullableString16 SetItem(
40 const string16& key, const string16& value, 35 const string16& key, const string16& value,
41 WebKit::WebStorageArea::Result* result, 36 WebKit::WebStorageArea::Result* result);
42 DOMStorageDispatcherHost* sender);
43 NullableString16 RemoveItem(const string16& key); 37 NullableString16 RemoveItem(const string16& key);
44 bool Clear(); 38 bool Clear();
45 void PurgeMemory(); 39 void PurgeMemory();
46 40
47 int64 id() const { return id_; } 41 int64 id() const { return id_; }
48 42
49 DOMStorageNamespace* owner() const { return owner_; } 43 DOMStorageNamespace* owner() const { return owner_; }
50 44
51 private: 45 private:
52 // Creates the underlying WebStorageArea on demand. 46 // Creates the underlying WebStorageArea on demand.
53 void CreateWebStorageAreaIfNecessary(); 47 void CreateWebStorageAreaIfNecessary();
54 48
55 // Used to see if setItem has permission to do its thing. 49 // Used to see if setItem has permission to do its thing.
56 bool CheckContentSetting(const string16& key, const string16& value, 50 bool CheckContentSetting(const string16& key, const string16& value);
57 DOMStorageDispatcherHost* sender);
58 51
59 // The origin this storage area represents. 52 // The origin this storage area represents.
60 string16 origin_; 53 string16 origin_;
61 GURL origin_url_; 54 GURL origin_url_;
62 55
63 // The storage area we wrap. 56 // The storage area we wrap.
64 scoped_ptr<WebKit::WebStorageArea> storage_area_; 57 scoped_ptr<WebKit::WebStorageArea> storage_area_;
65 58
66 // Our storage area id. Unique to our parent WebKitContext. 59 // Our storage area id. Unique to our parent WebKitContext.
67 int64 id_; 60 int64 id_;
(...skipping 13 matching lines...) Expand all
81 struct hash<DOMStorageArea*> { 74 struct hash<DOMStorageArea*> {
82 std::size_t operator()(DOMStorageArea* const& p) const { 75 std::size_t operator()(DOMStorageArea* const& p) const {
83 return reinterpret_cast<std::size_t>(p); 76 return reinterpret_cast<std::size_t>(p);
84 } 77 }
85 }; 78 };
86 79
87 } // namespace __gnu_cxx 80 } // namespace __gnu_cxx
88 #endif 81 #endif
89 82
90 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ 83 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698