| 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/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 namespace fileapi { | |
| 14 class FileSystemContext; | |
| 15 } | |
| 16 | |
| 17 namespace net { | 13 namespace net { |
| 18 class URLRequestContextGetter; | 14 class URLRequestContextGetter; |
| 19 } | 15 } |
| 20 | 16 |
| 21 namespace quota { | 17 namespace quota { |
| 22 class SpecialStoragePolicy; | 18 class SpecialStoragePolicy; |
| 23 } | 19 } |
| 24 | 20 |
| 25 class FilePath; | 21 class FilePath; |
| 26 class GURL; | 22 class GURL; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 // thread. | 37 // thread. |
| 42 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 38 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
| 43 public: | 39 public: |
| 44 // Used in ForEachStoragePartition(). The first argument is the partition id. | 40 // Used in ForEachStoragePartition(). The first argument is the partition id. |
| 45 // The second argument is the StoragePartition object for that partition id. | 41 // The second argument is the StoragePartition object for that partition id. |
| 46 typedef base::Callback<void(const std::string&, StoragePartition*)> | 42 typedef base::Callback<void(const std::string&, StoragePartition*)> |
| 47 StoragePartitionCallback; | 43 StoragePartitionCallback; |
| 48 | 44 |
| 49 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 45 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
| 50 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); | 46 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); |
| 51 static fileapi::FileSystemContext* GetFileSystemContext( | |
| 52 BrowserContext* browser_context); | |
| 53 | 47 |
| 54 static content::StoragePartition* GetStoragePartition( | 48 static content::StoragePartition* GetStoragePartition( |
| 55 BrowserContext* browser_context, SiteInstance* site_instance); | 49 BrowserContext* browser_context, SiteInstance* site_instance); |
| 56 static content::StoragePartition* GetStoragePartitionForSite( | 50 static content::StoragePartition* GetStoragePartitionForSite( |
| 57 BrowserContext* browser_context, const GURL& site); | 51 BrowserContext* browser_context, const GURL& site); |
| 58 static void ForEachStoragePartition( | 52 static void ForEachStoragePartition( |
| 59 BrowserContext* browser_context, | 53 BrowserContext* browser_context, |
| 60 const StoragePartitionCallback& callback); | 54 const StoragePartitionCallback& callback); |
| 61 | 55 |
| 62 // DON'T USE THIS. GetDefaultStoragePartition() is going away. | 56 // DON'T USE THIS. GetDefaultStoragePartition() is going away. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 74 // Tells the HTML5 objects on this context to persist their session state | 68 // Tells the HTML5 objects on this context to persist their session state |
| 75 // across the next restart. | 69 // across the next restart. |
| 76 static void SaveSessionState(BrowserContext* browser_context); | 70 static void SaveSessionState(BrowserContext* browser_context); |
| 77 | 71 |
| 78 // Tells the HTML5 objects on this context to purge any uneeded memory. | 72 // Tells the HTML5 objects on this context to purge any uneeded memory. |
| 79 static void PurgeMemory(BrowserContext* browser_context); | 73 static void PurgeMemory(BrowserContext* browser_context); |
| 80 | 74 |
| 81 virtual ~BrowserContext(); | 75 virtual ~BrowserContext(); |
| 82 | 76 |
| 83 // Returns the path of the directory where this context's data is stored. | 77 // Returns the path of the directory where this context's data is stored. |
| 78 // TODO(ajwong): This accessor needs to go away. Instead, people should get |
| 79 // the path from the StoragePartition. |
| 84 virtual FilePath GetPath() = 0; | 80 virtual FilePath GetPath() = 0; |
| 85 | 81 |
| 86 // Return whether this context is incognito. Default is false. | 82 // Return whether this context is incognito. Default is false. |
| 87 // This doesn't belong here; http://crbug.com/89628 | 83 // This doesn't belong here; http://crbug.com/89628 |
| 88 virtual bool IsOffTheRecord() const = 0; | 84 virtual bool IsOffTheRecord() const = 0; |
| 89 | 85 |
| 90 // Returns the request context information associated with this context. Call | 86 // Returns the request context information associated with this context. Call |
| 91 // this only on the UI thread, since it can send notifications that should | 87 // this only on the UI thread, since it can send notifications that should |
| 92 // happen on the UI thread. | 88 // happen on the UI thread. |
| 93 // TODO(creis): Remove this version in favor of the one below. | 89 // TODO(creis): Remove this version in favor of the one below. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 | 101 |
| 106 // Returns the default request context for media resources associated with | 102 // Returns the default request context for media resources associated with |
| 107 // this context. | 103 // this context. |
| 108 // TODO(creis): Remove this version in favor of the one below. | 104 // TODO(creis): Remove this version in favor of the one below. |
| 109 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; | 105 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; |
| 110 | 106 |
| 111 // Returns the request context for media resources associated with this | 107 // Returns the request context for media resources associated with this |
| 112 // context and renderer process. | 108 // context and renderer process. |
| 113 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 109 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
| 114 int renderer_child_id) = 0; | 110 int renderer_child_id) = 0; |
| 111 virtual net::URLRequestContextGetter* |
| 112 GetMediaRequestContextForStoragePartition( |
| 113 const std::string& partition_id) = 0; |
| 115 | 114 |
| 116 // Returns the resource context. | 115 // Returns the resource context. |
| 117 virtual ResourceContext* GetResourceContext() = 0; | 116 virtual ResourceContext* GetResourceContext() = 0; |
| 118 | 117 |
| 119 // Returns the DownloadManagerDelegate for this context. This will be called | 118 // Returns the DownloadManagerDelegate for this context. This will be called |
| 120 // once per context. The embedder owns the delegate and is responsible for | 119 // once per context. The embedder owns the delegate and is responsible for |
| 121 // ensuring that it outlives DownloadManager. It's valid to return NULL. | 120 // ensuring that it outlives DownloadManager. It's valid to return NULL. |
| 122 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | 121 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; |
| 123 | 122 |
| 124 // Returns the geolocation permission context for this context. It's valid to | 123 // Returns the geolocation permission context for this context. It's valid to |
| (...skipping 22 matching lines...) Expand all Loading... |
| 147 struct hash<content::BrowserContext*> { | 146 struct hash<content::BrowserContext*> { |
| 148 std::size_t operator()(content::BrowserContext* const& p) const { | 147 std::size_t operator()(content::BrowserContext* const& p) const { |
| 149 return reinterpret_cast<std::size_t>(p); | 148 return reinterpret_cast<std::size_t>(p); |
| 150 } | 149 } |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 } // namespace BASE_HASH_NAMESPACE | 152 } // namespace BASE_HASH_NAMESPACE |
| 154 #endif | 153 #endif |
| 155 | 154 |
| 156 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 155 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |