| 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 fileapi { | 13 namespace fileapi { | 
| 14 class FileSystemContext; | 14 class FileSystemContext; | 
| 15 } | 15 } | 
| 16 | 16 | 
| 17 namespace net { | 17 namespace net { | 
| 18 class URLRequestContextGetter; | 18 class URLRequestContextGetter; | 
| 19 } | 19 } | 
| 20 | 20 | 
| 21 namespace quota { | 21 namespace quota { | 
| 22 class QuotaManager; | 22 class QuotaManager; | 
|  | 23 class SpecialStoragePolicy; | 
| 23 } | 24 } | 
| 24 | 25 | 
| 25 namespace webkit_database { | 26 namespace webkit_database { | 
| 26 class DatabaseTracker; | 27 class DatabaseTracker; | 
| 27 } | 28 } | 
| 28 | 29 | 
| 29 class ChromeAppCacheService; | 30 class ChromeAppCacheService; | 
| 30 class ChromeBlobStorageContext; | 31 class ChromeBlobStorageContext; | 
| 31 class FilePath; | 32 class FilePath; | 
| 32 class WebKitContext; | 33 class WebKitContext; | 
| 33 | 34 | 
| 34 namespace content { | 35 namespace content { | 
| 35 | 36 | 
| 36 class DownloadManager; | 37 class DownloadManager; | 
| 37 class GeolocationPermissionContext; | 38 class GeolocationPermissionContext; | 
| 38 class HostZoomMap; | 39 class HostZoomMap; | 
| 39 class ResourceContext; | 40 class ResourceContext; | 
| 40 class SpeechInputPreferences; | 41 class SpeechInputPreferences; | 
| 41 | 42 | 
| 42 // This class holds the context needed for a browsing session. | 43 // This class holds the context needed for a browsing session. | 
| 43 // It lives on the UI thread. | 44 // It lives on the UI thread. | 
| 44 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 
| 45  public: | 46  public: | 
| 46    virtual ~BrowserContext() {} | 47   // Getter for the QuotaManager associated with the given BrowserContext. | 
|  | 48   static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); | 
|  | 49   static WebKitContext* GetWebKitContext(BrowserContext* browser_context); | 
|  | 50   static webkit_database::DatabaseTracker* GetDatabaseTracker( | 
|  | 51       BrowserContext* browser_context); | 
|  | 52   static ChromeAppCacheService* GetAppCacheService( | 
|  | 53       BrowserContext* browser_context); | 
|  | 54   static fileapi::FileSystemContext* GetFileSystemContext( | 
|  | 55       BrowserContext* browser_context); | 
|  | 56   static ChromeBlobStorageContext* GetBlobStorageContext( | 
|  | 57       BrowserContext* browser_context); | 
|  | 58 | 
|  | 59   virtual ~BrowserContext(); | 
| 47 | 60 | 
| 48   // Returns the path of the directory where this context's data is stored. | 61   // Returns the path of the directory where this context's data is stored. | 
| 49   virtual FilePath GetPath() = 0; | 62   virtual FilePath GetPath() = 0; | 
| 50 | 63 | 
| 51   // Return whether this context is incognito. Default is false. | 64   // Return whether this context is incognito. Default is false. | 
| 52   // This doesn't belong here; http://crbug.com/89628 | 65   // This doesn't belong here; http://crbug.com/89628 | 
| 53   virtual bool IsOffTheRecord() = 0; | 66   virtual bool IsOffTheRecord() = 0; | 
| 54 | 67 | 
| 55   // Returns the DownloadManager associated with this context. | 68   // Returns the DownloadManager associated with this context. | 
| 56   virtual content::DownloadManager* GetDownloadManager() = 0; | 69   virtual content::DownloadManager* GetDownloadManager() = 0; | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 83   virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | 96   virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | 
| 84 | 97 | 
| 85   // Returns the speech input preferences. SpeechInputPreferences is a | 98   // Returns the speech input preferences. SpeechInputPreferences is a | 
| 86   // ref counted class, so callers should take a reference if needed. | 99   // ref counted class, so callers should take a reference if needed. | 
| 87   virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0; | 100   virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0; | 
| 88 | 101 | 
| 89   // Returns true if the last time this context was open it was exited cleanly. | 102   // Returns true if the last time this context was open it was exited cleanly. | 
| 90   // This doesn't belong here; http://crbug.com/90737 | 103   // This doesn't belong here; http://crbug.com/90737 | 
| 91   virtual bool DidLastSessionExitCleanly() = 0; | 104   virtual bool DidLastSessionExitCleanly() = 0; | 
| 92 | 105 | 
| 93   // The following getters return references to various storage related | 106   // Returns a special storage policy implementation, or NULL. | 
| 94   // contexts associated with this browser context. | 107   virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0; | 
| 95   virtual quota::QuotaManager* GetQuotaManager() = 0; |  | 
| 96   virtual WebKitContext* GetWebKitContext() = 0; |  | 
| 97   virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |  | 
| 98   virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; |  | 
| 99   virtual ChromeAppCacheService* GetAppCacheService() = 0; |  | 
| 100   virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; |  | 
| 101 }; | 108 }; | 
| 102 | 109 | 
| 103 }  // namespace content | 110 }  // namespace content | 
| 104 | 111 | 
| 105 #if defined(COMPILER_GCC) | 112 #if defined(COMPILER_GCC) | 
| 106 namespace BASE_HASH_NAMESPACE { | 113 namespace BASE_HASH_NAMESPACE { | 
| 107 | 114 | 
| 108 template<> | 115 template<> | 
| 109 struct hash<content::BrowserContext*> { | 116 struct hash<content::BrowserContext*> { | 
| 110   std::size_t operator()(content::BrowserContext* const& p) const { | 117   std::size_t operator()(content::BrowserContext* const& p) const { | 
| 111     return reinterpret_cast<std::size_t>(p); | 118     return reinterpret_cast<std::size_t>(p); | 
| 112   } | 119   } | 
| 113 }; | 120 }; | 
| 114 | 121 | 
| 115 }  // namespace BASE_HASH_NAMESPACE | 122 }  // namespace BASE_HASH_NAMESPACE | 
| 116 #endif | 123 #endif | 
| 117 | 124 | 
| 118 #endif  // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 125 #endif  // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 
| OLD | NEW | 
|---|