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

Side by Side Diff: content/public/browser/browser_context.h

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review Created 8 years, 5 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 CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/supports_user_data.h" 10 #include "base/supports_user_data.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // that the ResourceContext is ready. 66 // that the ResourceContext is ready.
67 static void EnsureResourceContextInitialized(BrowserContext* browser_context); 67 static void EnsureResourceContextInitialized(BrowserContext* browser_context);
68 68
69 // Tells the HTML5 objects on this context to persist their session state 69 // Tells the HTML5 objects on this context to persist their session state
70 // across the next restart. 70 // across the next restart.
71 static void SaveSessionState(BrowserContext* browser_context); 71 static void SaveSessionState(BrowserContext* browser_context);
72 72
73 // Tells the HTML5 objects on this context to purge any uneeded memory. 73 // Tells the HTML5 objects on this context to purge any uneeded memory.
74 static void PurgeMemory(BrowserContext* browser_context); 74 static void PurgeMemory(BrowserContext* browser_context);
75 75
76 BrowserContext();
76 virtual ~BrowserContext(); 77 virtual ~BrowserContext();
77 78
78 // Returns the path of the directory where this context's data is stored. 79 // Returns the path of the directory where this context's data is stored.
79 virtual FilePath GetPath() = 0; 80 virtual FilePath GetPath() = 0;
80 81
81 // Return whether this context is incognito. Default is false. 82 // Return whether this context is incognito. Default is false.
82 // This doesn't belong here; http://crbug.com/89628 83 // This doesn't belong here; http://crbug.com/89628
83 virtual bool IsOffTheRecord() const = 0; 84 virtual bool IsOffTheRecord() const = 0;
84 85
85 // Returns the request context information associated with this context. Call 86 // Returns the request context information associated with this context. Call
(...skipping 30 matching lines...) Expand all
116 // ref counted class, so callers should take a reference if needed. It's valid 117 // ref counted class, so callers should take a reference if needed. It's valid
117 // to return NULL. 118 // to return NULL.
118 virtual SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() = 0; 119 virtual SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() = 0;
119 120
120 // Returns true if the last time this context was open it was exited cleanly. 121 // Returns true if the last time this context was open it was exited cleanly.
121 // This doesn't belong here; http://crbug.com/90737 122 // This doesn't belong here; http://crbug.com/90737
122 virtual bool DidLastSessionExitCleanly() = 0; 123 virtual bool DidLastSessionExitCleanly() = 0;
123 124
124 // Returns a special storage policy implementation, or NULL. 125 // Returns a special storage policy implementation, or NULL.
125 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0; 126 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0;
127
128 // Controls if sessionStorage should be saved on disk. This function must be
129 // called before any of the services are requested (see static getters
130 // above). Even if |save_session_storage_on_disk| is true, sessionStorage
131 // won't be saved if |IsOffTheRecord| returns true.
132 void SetSaveSessionStorageOnDisk(bool save_session_storage_on_disk);
133
134 bool save_session_storage_on_disk() const {
135 return save_session_storage_on_disk_;
136 }
137
138 private:
139 bool save_session_storage_on_disk_;
126 }; 140 };
127 141
128 } // namespace content 142 } // namespace content
129 143
130 #if defined(COMPILER_GCC) 144 #if defined(COMPILER_GCC)
131 namespace BASE_HASH_NAMESPACE { 145 namespace BASE_HASH_NAMESPACE {
132 146
133 template<> 147 template<>
134 struct hash<content::BrowserContext*> { 148 struct hash<content::BrowserContext*> {
135 std::size_t operator()(content::BrowserContext* const& p) const { 149 std::size_t operator()(content::BrowserContext* const& p) const {
136 return reinterpret_cast<std::size_t>(p); 150 return reinterpret_cast<std::size_t>(p);
137 } 151 }
138 }; 152 };
139 153
140 } // namespace BASE_HASH_NAMESPACE 154 } // namespace BASE_HASH_NAMESPACE
141 #endif 155 #endif
142 156
143 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ 157 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698