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