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 #pragma once | 7 #pragma once |
8 | 8 |
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 appcache { |
| 14 class AppCacheService; |
| 15 } |
| 16 |
13 namespace fileapi { | 17 namespace fileapi { |
14 class FileSystemContext; | 18 class FileSystemContext; |
15 } | 19 } |
16 | 20 |
17 namespace net { | 21 namespace net { |
18 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
19 } | 23 } |
20 | 24 |
21 namespace quota { | 25 namespace quota { |
22 class QuotaManager; | 26 class QuotaManager; |
23 class SpecialStoragePolicy; | 27 class SpecialStoragePolicy; |
24 } | 28 } |
25 | 29 |
26 namespace webkit_database { | 30 namespace webkit_database { |
27 class DatabaseTracker; | 31 class DatabaseTracker; |
28 } | 32 } |
29 | 33 |
30 class ChromeAppCacheService; | |
31 class ChromeBlobStorageContext; | |
32 class FilePath; | 34 class FilePath; |
33 class WebKitContext; | 35 class WebKitContext; |
34 | 36 |
35 namespace content { | 37 namespace content { |
36 | 38 |
37 class DownloadManager; | 39 class DownloadManager; |
38 class GeolocationPermissionContext; | 40 class GeolocationPermissionContext; |
39 class HostZoomMap; | 41 class HostZoomMap; |
40 class ResourceContext; | 42 class ResourceContext; |
41 class SpeechInputPreferences; | 43 class SpeechInputPreferences; |
42 | 44 |
43 // This class holds the context needed for a browsing session. | 45 // This class holds the context needed for a browsing session. |
44 // It lives on the UI thread. | 46 // It lives on the UI thread. |
45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 47 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
46 public: | 48 public: |
47 // Getter for the QuotaManager associated with the given BrowserContext. | 49 // Getter for the QuotaManager associated with the given BrowserContext. |
48 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); | 50 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); |
49 static WebKitContext* GetWebKitContext(BrowserContext* browser_context); | 51 static WebKitContext* GetWebKitContext(BrowserContext* browser_context); |
50 static webkit_database::DatabaseTracker* GetDatabaseTracker( | 52 static webkit_database::DatabaseTracker* GetDatabaseTracker( |
51 BrowserContext* browser_context); | 53 BrowserContext* browser_context); |
52 static ChromeAppCacheService* GetAppCacheService( | 54 static appcache::AppCacheService* GetAppCacheService( |
53 BrowserContext* browser_context); | 55 BrowserContext* browser_context); |
54 static fileapi::FileSystemContext* GetFileSystemContext( | 56 static fileapi::FileSystemContext* GetFileSystemContext( |
55 BrowserContext* browser_context); | 57 BrowserContext* browser_context); |
56 static ChromeBlobStorageContext* GetBlobStorageContext( | 58 |
57 BrowserContext* browser_context); | 59 // Ensures that the corresponding ResourceContext is initialized. Normally the |
| 60 // BrowserContext initializs the corresponding getters when its objects are |
| 61 // created, but if the embedder wants to pass the ResourceContext to another |
| 62 // thread before they use BrowserContext, they should call this to make sure |
| 63 // that the ResourceContext is ready. |
| 64 static void EnsureResourceContextInitialized(BrowserContext* browser_context); |
58 | 65 |
59 virtual ~BrowserContext(); | 66 virtual ~BrowserContext(); |
60 | 67 |
61 // Returns the path of the directory where this context's data is stored. | 68 // Returns the path of the directory where this context's data is stored. |
62 virtual FilePath GetPath() = 0; | 69 virtual FilePath GetPath() = 0; |
63 | 70 |
64 // Return whether this context is incognito. Default is false. | 71 // Return whether this context is incognito. Default is false. |
65 // This doesn't belong here; http://crbug.com/89628 | 72 // This doesn't belong here; http://crbug.com/89628 |
66 virtual bool IsOffTheRecord() = 0; | 73 virtual bool IsOffTheRecord() = 0; |
67 | 74 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 struct hash<content::BrowserContext*> { | 123 struct hash<content::BrowserContext*> { |
117 std::size_t operator()(content::BrowserContext* const& p) const { | 124 std::size_t operator()(content::BrowserContext* const& p) const { |
118 return reinterpret_cast<std::size_t>(p); | 125 return reinterpret_cast<std::size_t>(p); |
119 } | 126 } |
120 }; | 127 }; |
121 | 128 |
122 } // namespace BASE_HASH_NAMESPACE | 129 } // namespace BASE_HASH_NAMESPACE |
123 #endif | 130 #endif |
124 | 131 |
125 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 132 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |