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

Side by Side Diff: content/browser/in_process_webkit/dom_storage_namespace.h

Issue 7480041: Adding session-only localStorage. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Un-blocking the WebKit thread, delayed answering to the DOMStorageHostMsg_StorageAreaId. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "content/common/dom_storage_common.h" 12 #include "content/common/dom_storage_common.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
14 14
15 class DOMStorageArea; 15 class DOMStorageArea;
16 class DOMStorageContext; 16 class DOMStorageContext;
17 class FilePath; 17 class FilePath;
18 18
19 namespace IPC {
20 class Message;
21 }
22
19 namespace WebKit { 23 namespace WebKit {
20 class WebStorageArea; 24 class WebStorageArea;
21 class WebStorageNamespace; 25 class WebStorageNamespace;
22 } 26 }
23 27
24 // Only to be used on the WebKit thread. 28 // Only to be used on the WebKit thread.
25 class DOMStorageNamespace { 29 class DOMStorageNamespace {
26 public: 30 public:
31 class Delegate {
jochen (gone - plz use gerrit) 2011/07/29 08:01:06 instead of using this delegate, you should use bas
marja 2011/08/01 08:36:32 Done. (This will change again, though, after I've
32 public:
33 virtual void OnGotStorageArea(DOMStorageArea* storage_area,
34 IPC::Message* reply_msg) = 0;
35 };
36
27 static DOMStorageNamespace* CreateLocalStorageNamespace( 37 static DOMStorageNamespace* CreateLocalStorageNamespace(
28 DOMStorageContext* dom_storage_context, const FilePath& data_dir_path); 38 DOMStorageContext* dom_storage_context, const FilePath& data_dir_path);
29 static DOMStorageNamespace* CreateSessionStorageNamespace( 39 static DOMStorageNamespace* CreateSessionStorageNamespace(
30 DOMStorageContext* dom_storage_context, int64 namespace_id); 40 DOMStorageContext* dom_storage_context, int64 namespace_id);
31 41
32 ~DOMStorageNamespace(); 42 ~DOMStorageNamespace();
33 43
34 DOMStorageArea* GetStorageArea(const string16& origin); 44 DOMStorageArea* GetStorageArea(const string16& origin,
45 DOMStorageNamespace::Delegate* delegate,
46 IPC::Message* reply_msg);
47
35 DOMStorageNamespace* Copy(int64 clone_namespace_id); 48 DOMStorageNamespace* Copy(int64 clone_namespace_id);
36 49
37 void PurgeMemory(); 50 void PurgeMemory();
38 51
39 const DOMStorageContext* dom_storage_context() const { 52 const DOMStorageContext* dom_storage_context() const {
40 return dom_storage_context_; 53 return dom_storage_context_;
41 } 54 }
42 int64 id() const { return id_; } 55 int64 id() const { return id_; }
43 const WebKit::WebString& data_dir_path() const { return data_dir_path_; } 56 const WebKit::WebString& data_dir_path() const { return data_dir_path_; }
44 DOMStorageType dom_storage_type() const { return dom_storage_type_; } 57 DOMStorageType dom_storage_type() const { return dom_storage_type_; }
45 58
46 // Creates a WebStorageArea for the given origin. This should only be called 59 // Creates a WebStorageArea for the given origin. This should only be called
47 // by an owned DOMStorageArea. 60 // by an owned DOMStorageArea.
48 WebKit::WebStorageArea* CreateWebStorageArea(const string16& origin); 61 WebKit::WebStorageArea* CreateWebStorageArea(const string16& origin);
49 62
63 // Helpers for creating DOMStorageAreas.
64 DOMStorageArea* GetExistingStorageArea(const string16& origin);
65 DOMStorageArea* CreateStorageAreaInWebKitThread(const string16& origin,
66 bool allow_permanent_storage,
67 Delegate* delegate,
68 IPC::Message* reply_msg);
50 private: 69 private:
51 // Called by the static factory methods above. 70 // Called by the static factory methods above.
52 DOMStorageNamespace(DOMStorageContext* dom_storage_context, 71 DOMStorageNamespace(DOMStorageContext* dom_storage_context,
53 int64 id, 72 int64 id,
54 const WebKit::WebString& data_dir_path, 73 const WebKit::WebString& data_dir_path,
55 DOMStorageType storage_type); 74 DOMStorageType storage_type);
56 75
57 // Creates the underlying WebStorageNamespace on demand. 76 // Creates the underlying WebStorageNamespace on demand.
58 void CreateWebStorageNamespaceIfNecessary(); 77 void CreateWebStorageNamespaceIfNecessary();
59 78
(...skipping 10 matching lines...) Expand all
70 // Our id. Unique to our parent WebKitContext class. 89 // Our id. Unique to our parent WebKitContext class.
71 int64 id_; 90 int64 id_;
72 91
73 // The path used to create us, so we can recreate our WebStorageNamespace on 92 // The path used to create us, so we can recreate our WebStorageNamespace on
74 // demand. 93 // demand.
75 WebKit::WebString data_dir_path_; 94 WebKit::WebString data_dir_path_;
76 95
77 // SessionStorage vs. LocalStorage. 96 // SessionStorage vs. LocalStorage.
78 const DOMStorageType dom_storage_type_; 97 const DOMStorageType dom_storage_type_;
79 98
99 // A LocalStorage namespace holds a pointer to a session-only LocalStorage
100 // namespace. NULL if this DOMStorageNamespace is a SessionStorage, or a
101 // session-only LocalStorage, or a LocalStorage associated with an off the
102 // record profile.
103 scoped_ptr<DOMStorageNamespace> session_only_local_storage_;
104
80 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageNamespace); 105 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageNamespace);
81 }; 106 };
82 107
83 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 108 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698