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

Side by Side Diff: webkit/browser/dom_storage/dom_storage_host.h

Issue 16415016: Move nullable_string16.h to the string subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 7 years, 6 months 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) 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 WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_ 5 #ifndef WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
6 #define WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_ 6 #define WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/nullable_string16.h" 11 #include "base/strings/nullable_string16.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "webkit/common/dom_storage/dom_storage_types.h" 13 #include "webkit/common/dom_storage/dom_storage_types.h"
14 #include "webkit/storage/webkit_storage_export.h" 14 #include "webkit/storage/webkit_storage_export.h"
15 15
16 class GURL; 16 class GURL;
17 17
18 namespace dom_storage { 18 namespace dom_storage {
19 19
20 class DomStorageContext; 20 class DomStorageContext;
21 class DomStorageHost; 21 class DomStorageHost;
22 class DomStorageNamespace; 22 class DomStorageNamespace;
23 class DomStorageArea; 23 class DomStorageArea;
24 24
25 // One instance is allocated in the main process for each client process. 25 // One instance is allocated in the main process for each client process.
26 // Used by DomStorageMessageFilter in Chrome and by SimpleDomStorage in DRT. 26 // Used by DomStorageMessageFilter in Chrome and by SimpleDomStorage in DRT.
27 // This class is single threaded, and performs blocking file reads/writes, 27 // This class is single threaded, and performs blocking file reads/writes,
28 // so it shouldn't be used on chrome's IO thread. 28 // so it shouldn't be used on chrome's IO thread.
29 // See class comments for DomStorageContext for a larger overview. 29 // See class comments for DomStorageContext for a larger overview.
30 class WEBKIT_STORAGE_EXPORT DomStorageHost { 30 class WEBKIT_STORAGE_EXPORT DomStorageHost {
31 public: 31 public:
32 explicit DomStorageHost(DomStorageContext* context); 32 explicit DomStorageHost(DomStorageContext* context);
33 ~DomStorageHost(); 33 ~DomStorageHost();
34 34
35 bool OpenStorageArea(int connection_id, int namespace_id, 35 bool OpenStorageArea(int connection_id, int namespace_id,
36 const GURL& origin); 36 const GURL& origin);
37 void CloseStorageArea(int connection_id); 37 void CloseStorageArea(int connection_id);
38 bool ExtractAreaValues(int connection_id, ValuesMap* map); 38 bool ExtractAreaValues(int connection_id, ValuesMap* map);
39 unsigned GetAreaLength(int connection_id); 39 unsigned GetAreaLength(int connection_id);
40 NullableString16 GetAreaKey(int connection_id, unsigned index); 40 base::NullableString16 GetAreaKey(int connection_id, unsigned index);
41 NullableString16 GetAreaItem(int connection_id, const base::string16& key); 41 base::NullableString16 GetAreaItem(int connection_id,
42 const base::string16& key);
42 bool SetAreaItem(int connection_id, const base::string16& key, 43 bool SetAreaItem(int connection_id, const base::string16& key,
43 const base::string16& value, const GURL& page_url, 44 const base::string16& value, const GURL& page_url,
44 NullableString16* old_value); 45 base::NullableString16* old_value);
45 bool RemoveAreaItem(int connection_id, const base::string16& key, 46 bool RemoveAreaItem(int connection_id, const base::string16& key,
46 const GURL& page_url, 47 const GURL& page_url,
47 base::string16* old_value); 48 base::string16* old_value);
48 bool ClearArea(int connection_id, const GURL& page_url); 49 bool ClearArea(int connection_id, const GURL& page_url);
49 bool HasAreaOpen(int namespace_id, const GURL& origin) const; 50 bool HasAreaOpen(int namespace_id, const GURL& origin) const;
50 51
51 private: 52 private:
52 // Struct to hold references needed for areas that are open 53 // Struct to hold references needed for areas that are open
53 // within our associated client process. 54 // within our associated client process.
54 struct NamespaceAndArea { 55 struct NamespaceAndArea {
55 scoped_refptr<DomStorageNamespace> namespace_; 56 scoped_refptr<DomStorageNamespace> namespace_;
56 scoped_refptr<DomStorageArea> area_; 57 scoped_refptr<DomStorageArea> area_;
57 NamespaceAndArea(); 58 NamespaceAndArea();
58 ~NamespaceAndArea(); 59 ~NamespaceAndArea();
59 }; 60 };
60 typedef std::map<int, NamespaceAndArea > AreaMap; 61 typedef std::map<int, NamespaceAndArea > AreaMap;
61 62
62 DomStorageArea* GetOpenArea(int connection_id); 63 DomStorageArea* GetOpenArea(int connection_id);
63 DomStorageNamespace* GetNamespace(int connection_id); 64 DomStorageNamespace* GetNamespace(int connection_id);
64 65
65 scoped_refptr<DomStorageContext> context_; 66 scoped_refptr<DomStorageContext> context_;
66 AreaMap connections_; 67 AreaMap connections_;
67 }; 68 };
68 69
69 } // namespace dom_storage 70 } // namespace dom_storage
70 71
71 #endif // WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_ 72 #endif // WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
OLDNEW
« no previous file with comments | « webkit/browser/dom_storage/dom_storage_database_unittest.cc ('k') | webkit/browser/dom_storage/dom_storage_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698