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

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

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile gdi. Created 7 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) 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 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 13 matching lines...) Expand all
24 namespace net { 24 namespace net {
25 class URLRequestContextGetter; 25 class URLRequestContextGetter;
26 } 26 }
27 27
28 namespace quota { 28 namespace quota {
29 class SpecialStoragePolicy; 29 class SpecialStoragePolicy;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 33
34 class CookieStoreMap;
34 class DownloadManager; 35 class DownloadManager;
35 class DownloadManagerDelegate; 36 class DownloadManagerDelegate;
36 class GeolocationPermissionContext; 37 class GeolocationPermissionContext;
37 class IndexedDBContext; 38 class IndexedDBContext;
38 class ResourceContext; 39 class ResourceContext;
39 class SiteInstance; 40 class SiteInstance;
40 class StoragePartition; 41 class StoragePartition;
42 struct CookieStoreConfig;
41 43
42 // This class holds the context needed for a browsing session. 44 // This class holds the context needed for a browsing session.
43 // It lives on the UI thread. All these methods must only be called on the UI 45 // It lives on the UI thread. All these methods must only be called on the UI
44 // thread. 46 // thread.
45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { 47 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
46 public: 48 public:
47 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); 49 static DownloadManager* GetDownloadManager(BrowserContext* browser_context);
48 50
49 // Returns BrowserContext specific external mount points. It may return NULL 51 // Returns BrowserContext specific external mount points. It may return NULL
50 // if the context doesn't have any BrowserContext specific external mount 52 // if the context doesn't have any BrowserContext specific external mount
(...skipping 13 matching lines...) Expand all
64 const GURL& site, 66 const GURL& site,
65 const base::Closure& on_gc_required); 67 const base::Closure& on_gc_required);
66 68
67 // This function clears the contents of |active_paths| but does not take 69 // This function clears the contents of |active_paths| but does not take
68 // ownership of the pointer. 70 // ownership of the pointer.
69 static void GarbageCollectStoragePartitions( 71 static void GarbageCollectStoragePartitions(
70 BrowserContext* browser_context, 72 BrowserContext* browser_context,
71 scoped_ptr<base::hash_set<base::FilePath> > active_paths, 73 scoped_ptr<base::hash_set<base::FilePath> > active_paths,
72 const base::Closure& done); 74 const base::Closure& done);
73 75
74 // DON'T USE THIS. GetDefaultStoragePartition() is going away. 76 // Prefer GetStoragePartition() or GetStoragePartitionForSite() above. Only
75 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. 77 // use this if it is 100% certain that the cookie store, cache, etc., that
78 // is returned by this will be the correct one.
76 static content::StoragePartition* GetDefaultStoragePartition( 79 static content::StoragePartition* GetDefaultStoragePartition(
77 BrowserContext* browser_context); 80 BrowserContext* browser_context);
78 81
79 // Ensures that the corresponding ResourceContext is initialized. Normally the 82 // Ensures that the corresponding ResourceContext is initialized. Normally the
80 // BrowserContext initializs the corresponding getters when its objects are 83 // BrowserContext initializs the corresponding getters when its objects are
81 // created, but if the embedder wants to pass the ResourceContext to another 84 // created, but if the embedder wants to pass the ResourceContext to another
82 // thread before they use BrowserContext, they should call this to make sure 85 // thread before they use BrowserContext, they should call this to make sure
83 // that the ResourceContext is ready. 86 // that the ResourceContext is ready.
84 static void EnsureResourceContextInitialized(BrowserContext* browser_context); 87 static void EnsureResourceContextInitialized(BrowserContext* browser_context);
85 88
86 // Tells the HTML5 objects on this context to persist their session state 89 // Tells the HTML5 objects on this context to persist their session state
87 // across the next restart. 90 // across the next restart.
88 static void SaveSessionState(BrowserContext* browser_context); 91 static void SaveSessionState(BrowserContext* browser_context);
89 92
90 // Tells the HTML5 objects on this context to purge any uneeded memory. 93 // Tells the HTML5 objects on this context to purge any uneeded memory.
91 static void PurgeMemory(BrowserContext* browser_context); 94 static void PurgeMemory(BrowserContext* browser_context);
92 95
93 virtual ~BrowserContext(); 96 virtual ~BrowserContext();
94 97
95 // Returns the path of the directory where this context's data is stored. 98 // Returns the path of the directory where this context's data is stored.
96 virtual base::FilePath GetPath() const = 0; 99 virtual base::FilePath GetPath() const = 0;
97 100
98 // Return whether this context is incognito. Default is false. 101 // Return whether this context is incognito. Default is false.
99 virtual bool IsOffTheRecord() const = 0; 102 virtual bool IsOffTheRecord() const = 0;
100 103
104 // Retrieves configuration parameters for CookieStores created by this
105 // BrowserContext.
106 virtual CookieStoreConfig GetCookieStoreConfig() = 0;
107
101 // Returns the request context information associated with this context. Call 108 // Returns the request context information associated with this context. Call
102 // this only on the UI thread, since it can send notifications that should 109 // this only on the UI thread, since it can send notifications that should
103 // happen on the UI thread. 110 // happen on the UI thread.
104 // TODO(creis): Remove this version in favor of the one below. 111 // TODO(creis): Remove this version in favor of the one below.
105 virtual net::URLRequestContextGetter* GetRequestContext() = 0; 112 virtual net::URLRequestContextGetter* GetRequestContext() = 0;
106 113
107 // Returns the request context appropriate for the given renderer. If the 114 // Returns the request context appropriate for the given renderer. If the
108 // renderer process doesn't have an associated installed app, or if the 115 // renderer process doesn't have an associated installed app, or if the
109 // installed app doesn't have isolated storage, this is equivalent to calling 116 // installed app doesn't have isolated storage, this is equivalent to calling
110 // GetRequestContext(). 117 // GetRequestContext().
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // once per context. The embedder owns the delegate and is responsible for 149 // once per context. The embedder owns the delegate and is responsible for
143 // ensuring that it outlives DownloadManager. It's valid to return NULL. 150 // ensuring that it outlives DownloadManager. It's valid to return NULL.
144 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; 151 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0;
145 152
146 // Returns the geolocation permission context for this context. It's valid to 153 // Returns the geolocation permission context for this context. It's valid to
147 // return NULL, in which case geolocation requests will always be allowed. 154 // return NULL, in which case geolocation requests will always be allowed.
148 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; 155 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0;
149 156
150 // Returns a special storage policy implementation, or NULL. 157 // Returns a special storage policy implementation, or NULL.
151 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0; 158 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0;
159
160 // Allow the embedder to override the cookie store based on the scheme.
161 virtual void OverrideCookieStoreMap(
162 bool in_memory,
163 const base::FilePath& partition_path,
164 bool is_default,
165 CookieStoreMap* cookie_store_map) {}
152 }; 166 };
153 167
154 } // namespace content 168 } // namespace content
155 169
156 #if defined(COMPILER_GCC) 170 #if defined(COMPILER_GCC)
157 namespace BASE_HASH_NAMESPACE { 171 namespace BASE_HASH_NAMESPACE {
158 172
159 template<> 173 template<>
160 struct hash<content::BrowserContext*> { 174 struct hash<content::BrowserContext*> {
161 std::size_t operator()(content::BrowserContext* const& p) const { 175 std::size_t operator()(content::BrowserContext* const& p) const {
162 return reinterpret_cast<std::size_t>(p); 176 return reinterpret_cast<std::size_t>(p);
163 } 177 }
164 }; 178 };
165 179
166 } // namespace BASE_HASH_NAMESPACE 180 } // namespace BASE_HASH_NAMESPACE
167 #endif 181 #endif
168 182
169 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ 183 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698