| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_BROWSER_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_CONTEXT_H_ | 6 #define CONTENT_BROWSER_BROWSER_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/hash_tables.h" | 9 // Deprecated header. |
| 10 | 10 // TODO(joi): Remove in a follow-up change. |
| 11 namespace fileapi { | 11 #include "content/public/browser/browser_context.h" |
| 12 class FileSystemContext; | |
| 13 } | |
| 14 | |
| 15 namespace net { | |
| 16 class URLRequestContextGetter; | |
| 17 } | |
| 18 | |
| 19 namespace quota { | |
| 20 class QuotaManager; | |
| 21 } | |
| 22 | |
| 23 namespace webkit_database { | |
| 24 class DatabaseTracker; | |
| 25 } | |
| 26 | |
| 27 class ChromeAppCacheService; | |
| 28 class ChromeBlobStorageContext; | |
| 29 class DownloadManager; | |
| 30 class FilePath; | |
| 31 class GeolocationPermissionContext; | |
| 32 class SpeechInputPreferences; | |
| 33 class HostZoomMap; | |
| 34 class SSLHostState; | |
| 35 class WebKitContext; | |
| 36 | |
| 37 namespace content { | |
| 38 | |
| 39 class ResourceContext; | |
| 40 | |
| 41 // This class holds the context needed for a browsing session. | |
| 42 // It lives on the UI thread. | |
| 43 class BrowserContext { | |
| 44 public: | |
| 45 virtual ~BrowserContext() {} | |
| 46 | |
| 47 // Returns the path of the directory where this context's data is stored. | |
| 48 virtual FilePath GetPath() = 0; | |
| 49 | |
| 50 // Return whether this context is incognito. Default is false. | |
| 51 // This doesn't belong here; http://crbug.com/89628 | |
| 52 virtual bool IsOffTheRecord() = 0; | |
| 53 | |
| 54 // Retrieves a pointer to the SSLHostState associated with this context. | |
| 55 // The SSLHostState is lazily created the first time that this method is | |
| 56 // called. | |
| 57 virtual SSLHostState* GetSSLHostState() = 0; | |
| 58 | |
| 59 // Returns the DownloadManager associated with this context. | |
| 60 virtual DownloadManager* GetDownloadManager() = 0; | |
| 61 | |
| 62 // Returns the request context information associated with this context. Call | |
| 63 // this only on the UI thread, since it can send notifications that should | |
| 64 // happen on the UI thread. | |
| 65 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | |
| 66 | |
| 67 // Returns the request context appropriate for the given renderer. If the | |
| 68 // renderer process doesn't have an associated installed app, or if the | |
| 69 // installed app's is_storage_isolated() returns false, this is equivalent to | |
| 70 // calling GetRequestContext(). | |
| 71 // TODO(creis): After isolated app storage is no longer an experimental | |
| 72 // feature, consider making this the default contract for GetRequestContext. | |
| 73 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | |
| 74 int renderer_child_id) = 0; | |
| 75 | |
| 76 // Returns the request context for media resources asociated with this | |
| 77 // context. | |
| 78 virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; | |
| 79 | |
| 80 // Returns the resource context. | |
| 81 virtual const ResourceContext& GetResourceContext() = 0; | |
| 82 | |
| 83 // Returns the Hostname <-> Zoom Level map for this context. | |
| 84 virtual HostZoomMap* GetHostZoomMap() = 0; | |
| 85 | |
| 86 // Returns the geolocation permission context for this context. | |
| 87 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | |
| 88 | |
| 89 // Returns the speech input preferences. SpeechInputPreferences is a | |
| 90 // ref counted class, so callers should take a reference if needed. | |
| 91 virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0; | |
| 92 | |
| 93 // Returns true if the last time this context was open it was exited cleanly. | |
| 94 // This doesn't belong here; http://crbug.com/90737 | |
| 95 virtual bool DidLastSessionExitCleanly() = 0; | |
| 96 | |
| 97 // The following getters return references to various storage related | |
| 98 // contexts associated with this browser context. | |
| 99 virtual quota::QuotaManager* GetQuotaManager() = 0; | |
| 100 virtual WebKitContext* GetWebKitContext() = 0; | |
| 101 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | |
| 102 virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; | |
| 103 virtual ChromeAppCacheService* GetAppCacheService() = 0; | |
| 104 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; | |
| 105 }; | |
| 106 | |
| 107 } // namespace content | |
| 108 | |
| 109 #if defined(COMPILER_GCC) | |
| 110 namespace __gnu_cxx { | |
| 111 | |
| 112 template<> | |
| 113 struct hash<content::BrowserContext*> { | |
| 114 std::size_t operator()(content::BrowserContext* const& p) const { | |
| 115 return reinterpret_cast<std::size_t>(p); | |
| 116 } | |
| 117 }; | |
| 118 | |
| 119 } // namespace __gnu_cxx | |
| 120 #endif | |
| 121 | 12 |
| 122 #endif // CONTENT_BROWSER_BROWSER_CONTEXT_H_ | 13 #endif // CONTENT_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |