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 typedef base::Callback<void(const std::string&, StoragePartition*)> | |
54 StoragePartitionCallback; | |
50 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 55 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
51 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); | 56 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); | 57 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); |
59 static webkit_database::DatabaseTracker* GetDatabaseTracker( | 58 static webkit_database::DatabaseTracker* GetDatabaseTracker( |
60 BrowserContext* browser_context); | 59 BrowserContext* browser_context); |
61 static appcache::AppCacheService* GetAppCacheService( | 60 static appcache::AppCacheService* GetAppCacheService( |
62 BrowserContext* browser_context); | 61 BrowserContext* browser_context); |
63 static fileapi::FileSystemContext* GetFileSystemContext( | 62 static fileapi::FileSystemContext* GetFileSystemContext( |
64 BrowserContext* browser_context); | 63 BrowserContext* browser_context); |
65 | 64 |
65 static content::StoragePartition* GetStoragePartition( | |
66 BrowserContext* browser_context, SiteInstance* site_instance); | |
67 static void ForEachStoragePartition( | |
Charlie Reis
2012/08/14 18:50:12
Maybe add a comment here or on the callback typede
awong
2012/08/14 19:12:47
Right. Good idea.
| |
68 BrowserContext* browser_context, | |
69 const StoragePartitionCallback& callback); | |
70 | |
71 // DON'T USE THIS. GetDefaultStoragePartition() is going away. | |
72 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. | |
73 static content::StoragePartition* GetDefaultStoragePartition( | |
74 BrowserContext* browser_context); | |
75 | |
66 // Ensures that the corresponding ResourceContext is initialized. Normally the | 76 // Ensures that the corresponding ResourceContext is initialized. Normally the |
67 // BrowserContext initializs the corresponding getters when its objects are | 77 // BrowserContext initializs the corresponding getters when its objects are |
68 // created, but if the embedder wants to pass the ResourceContext to another | 78 // 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 | 79 // thread before they use BrowserContext, they should call this to make sure |
70 // that the ResourceContext is ready. | 80 // that the ResourceContext is ready. |
71 static void EnsureResourceContextInitialized(BrowserContext* browser_context); | 81 static void EnsureResourceContextInitialized(BrowserContext* browser_context); |
72 | 82 |
73 // Tells the HTML5 objects on this context to persist their session state | 83 // Tells the HTML5 objects on this context to persist their session state |
74 // across the next restart. | 84 // across the next restart. |
75 static void SaveSessionState(BrowserContext* browser_context); | 85 static void SaveSessionState(BrowserContext* browser_context); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 struct hash<content::BrowserContext*> { | 148 struct hash<content::BrowserContext*> { |
139 std::size_t operator()(content::BrowserContext* const& p) const { | 149 std::size_t operator()(content::BrowserContext* const& p) const { |
140 return reinterpret_cast<std::size_t>(p); | 150 return reinterpret_cast<std::size_t>(p); |
141 } | 151 } |
142 }; | 152 }; |
143 | 153 |
144 } // namespace BASE_HASH_NAMESPACE | 154 } // namespace BASE_HASH_NAMESPACE |
145 #endif | 155 #endif |
146 | 156 |
147 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 157 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |