Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 BlobHandle; | |
| 34 class BrowserPluginGuestManager; | 35 class BrowserPluginGuestManager; |
| 35 class DownloadManager; | 36 class DownloadManager; |
| 36 class DownloadManagerDelegate; | 37 class DownloadManagerDelegate; |
| 37 class GeolocationPermissionContext; | 38 class GeolocationPermissionContext; |
| 38 class IndexedDBContext; | 39 class IndexedDBContext; |
| 39 class ResourceContext; | 40 class ResourceContext; |
| 40 class SiteInstance; | 41 class SiteInstance; |
| 41 class StoragePartition; | 42 class StoragePartition; |
| 42 | 43 |
| 43 // This class holds the context needed for a browsing session. | 44 // This class holds the context needed for a browsing session. |
| 44 // 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 |
| 45 // thread. | 46 // thread. |
| 46 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 47 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
| 47 public: | 48 public: |
| 49 typedef base::Callback<void(scoped_ptr<BlobHandle>)> BlobCallback; | |
|
jam
2014/05/14 17:14:00
nit: convention in content api is to put the callb
tommycli
2014/05/14 18:07:05
Done.
| |
| 50 | |
| 48 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 51 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
| 49 | 52 |
| 50 // Returns BrowserContext specific external mount points. It may return NULL | 53 // Returns BrowserContext specific external mount points. It may return NULL |
| 51 // if the context doesn't have any BrowserContext specific external mount | 54 // if the context doesn't have any BrowserContext specific external mount |
| 52 // points. Currenty, non-NULL value is returned only on ChromeOS. | 55 // points. Currenty, non-NULL value is returned only on ChromeOS. |
| 53 static fileapi::ExternalMountPoints* GetMountPoints(BrowserContext* context); | 56 static fileapi::ExternalMountPoints* GetMountPoints(BrowserContext* context); |
| 54 | 57 |
| 55 static content::StoragePartition* GetStoragePartition( | 58 static content::StoragePartition* GetStoragePartition( |
| 56 BrowserContext* browser_context, SiteInstance* site_instance); | 59 BrowserContext* browser_context, SiteInstance* site_instance); |
| 57 static content::StoragePartition* GetStoragePartitionForSite( | 60 static content::StoragePartition* GetStoragePartitionForSite( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 70 static void GarbageCollectStoragePartitions( | 73 static void GarbageCollectStoragePartitions( |
| 71 BrowserContext* browser_context, | 74 BrowserContext* browser_context, |
| 72 scoped_ptr<base::hash_set<base::FilePath> > active_paths, | 75 scoped_ptr<base::hash_set<base::FilePath> > active_paths, |
| 73 const base::Closure& done); | 76 const base::Closure& done); |
| 74 | 77 |
| 75 // DON'T USE THIS. GetDefaultStoragePartition() is going away. | 78 // DON'T USE THIS. GetDefaultStoragePartition() is going away. |
| 76 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. | 79 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. |
| 77 static content::StoragePartition* GetDefaultStoragePartition( | 80 static content::StoragePartition* GetDefaultStoragePartition( |
| 78 BrowserContext* browser_context); | 81 BrowserContext* browser_context); |
| 79 | 82 |
| 83 // |callback| returns a NULL scoped_ptr on failure. | |
| 84 static void CreateMemoryBackedBlob(BrowserContext* browser_context, | |
| 85 const char* data, size_t length, | |
| 86 const BlobCallback& callback); | |
| 87 | |
| 80 // Ensures that the corresponding ResourceContext is initialized. Normally the | 88 // Ensures that the corresponding ResourceContext is initialized. Normally the |
| 81 // BrowserContext initializs the corresponding getters when its objects are | 89 // BrowserContext initializs the corresponding getters when its objects are |
| 82 // created, but if the embedder wants to pass the ResourceContext to another | 90 // created, but if the embedder wants to pass the ResourceContext to another |
| 83 // thread before they use BrowserContext, they should call this to make sure | 91 // thread before they use BrowserContext, they should call this to make sure |
| 84 // that the ResourceContext is ready. | 92 // that the ResourceContext is ready. |
| 85 static void EnsureResourceContextInitialized(BrowserContext* browser_context); | 93 static void EnsureResourceContextInitialized(BrowserContext* browser_context); |
| 86 | 94 |
| 87 // Tells the HTML5 objects on this context to persist their session state | 95 // Tells the HTML5 objects on this context to persist their session state |
| 88 // across the next restart. | 96 // across the next restart. |
| 89 static void SaveSessionState(BrowserContext* browser_context); | 97 static void SaveSessionState(BrowserContext* browser_context); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 struct hash<content::BrowserContext*> { | 194 struct hash<content::BrowserContext*> { |
| 187 std::size_t operator()(content::BrowserContext* const& p) const { | 195 std::size_t operator()(content::BrowserContext* const& p) const { |
| 188 return reinterpret_cast<std::size_t>(p); | 196 return reinterpret_cast<std::size_t>(p); |
| 189 } | 197 } |
| 190 }; | 198 }; |
| 191 | 199 |
| 192 } // namespace BASE_HASH_NAMESPACE | 200 } // namespace BASE_HASH_NAMESPACE |
| 193 #endif | 201 #endif |
| 194 | 202 |
| 195 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 203 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |