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/hash_tables.h" | 9 #include "base/hash_tables.h" |
9 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 | 12 |
12 namespace appcache { | 13 namespace appcache { |
13 class AppCacheService; | 14 class AppCacheService; |
14 } | 15 } |
15 | 16 |
16 namespace fileapi { | 17 namespace fileapi { |
17 class FileSystemContext; | 18 class FileSystemContext; |
(...skipping 15 matching lines...) Expand all Loading... |
33 class FilePath; | 34 class FilePath; |
34 | 35 |
35 namespace content { | 36 namespace content { |
36 | 37 |
37 class DOMStorageContext; | 38 class DOMStorageContext; |
38 class DownloadManager; | 39 class DownloadManager; |
39 class DownloadManagerDelegate; | 40 class DownloadManagerDelegate; |
40 class GeolocationPermissionContext; | 41 class GeolocationPermissionContext; |
41 class IndexedDBContext; | 42 class IndexedDBContext; |
42 class ResourceContext; | 43 class ResourceContext; |
| 44 class SiteInstance; |
43 class SpeechRecognitionPreferences; | 45 class SpeechRecognitionPreferences; |
| 46 class StoragePartition; |
44 | 47 |
45 // This class holds the context needed for a browsing session. | 48 // This class holds the context needed for a browsing session. |
46 // It lives on the UI thread. All these methods must only be called on the UI | 49 // It lives on the UI thread. All these methods must only be called on the UI |
47 // thread. | 50 // thread. |
48 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 51 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
49 public: | 52 public: |
| 53 // Used in ForEachStoragePartition(). The first argument is the partition id. |
| 54 // The second argument is the StoragePartition object for that partition id. |
| 55 typedef base::Callback<void(const std::string&, StoragePartition*)> |
| 56 StoragePartitionCallback; |
| 57 |
50 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 58 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
51 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); | 59 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); |
52 static DOMStorageContext* GetDefaultDOMStorageContext( | |
53 BrowserContext* browser_context); | |
54 static DOMStorageContext* GetDOMStorageContext( | |
55 BrowserContext* browser_context, int renderer_child_id); | |
56 static content::DOMStorageContext* GetDOMStorageContextByPartitionId( | |
57 BrowserContext* browser_context, const std::string& partition_id); | |
58 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); | 60 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); |
59 static webkit_database::DatabaseTracker* GetDatabaseTracker( | 61 static webkit_database::DatabaseTracker* GetDatabaseTracker( |
60 BrowserContext* browser_context); | 62 BrowserContext* browser_context); |
61 static appcache::AppCacheService* GetAppCacheService( | 63 static appcache::AppCacheService* GetAppCacheService( |
62 BrowserContext* browser_context); | 64 BrowserContext* browser_context); |
63 static fileapi::FileSystemContext* GetFileSystemContext( | 65 static fileapi::FileSystemContext* GetFileSystemContext( |
64 BrowserContext* browser_context); | 66 BrowserContext* browser_context); |
65 | 67 |
| 68 static content::StoragePartition* GetStoragePartition( |
| 69 BrowserContext* browser_context, SiteInstance* site_instance); |
| 70 static void ForEachStoragePartition( |
| 71 BrowserContext* browser_context, |
| 72 const StoragePartitionCallback& callback); |
| 73 |
| 74 // DON'T USE THIS. GetDefaultStoragePartition() is going away. |
| 75 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. |
| 76 static content::StoragePartition* GetDefaultStoragePartition( |
| 77 BrowserContext* browser_context); |
| 78 |
66 // Ensures that the corresponding ResourceContext is initialized. Normally the | 79 // Ensures that the corresponding ResourceContext is initialized. Normally the |
67 // BrowserContext initializs the corresponding getters when its objects are | 80 // BrowserContext initializs the corresponding getters when its objects are |
68 // created, but if the embedder wants to pass the ResourceContext to another | 81 // created, but if the embedder wants to pass the ResourceContext to another |
69 // thread before they use BrowserContext, they should call this to make sure | 82 // thread before they use BrowserContext, they should call this to make sure |
70 // that the ResourceContext is ready. | 83 // that the ResourceContext is ready. |
71 static void EnsureResourceContextInitialized(BrowserContext* browser_context); | 84 static void EnsureResourceContextInitialized(BrowserContext* browser_context); |
72 | 85 |
73 // Tells the HTML5 objects on this context to persist their session state | 86 // Tells the HTML5 objects on this context to persist their session state |
74 // across the next restart. | 87 // across the next restart. |
75 static void SaveSessionState(BrowserContext* browser_context); | 88 static void SaveSessionState(BrowserContext* browser_context); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 struct hash<content::BrowserContext*> { | 151 struct hash<content::BrowserContext*> { |
139 std::size_t operator()(content::BrowserContext* const& p) const { | 152 std::size_t operator()(content::BrowserContext* const& p) const { |
140 return reinterpret_cast<std::size_t>(p); | 153 return reinterpret_cast<std::size_t>(p); |
141 } | 154 } |
142 }; | 155 }; |
143 | 156 |
144 } // namespace BASE_HASH_NAMESPACE | 157 } // namespace BASE_HASH_NAMESPACE |
145 #endif | 158 #endif |
146 | 159 |
147 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 160 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |