| 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/callback_forward.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace quota { | 28 namespace quota { |
| 29 class SpecialStoragePolicy; | 29 class SpecialStoragePolicy; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 class DownloadManager; | 34 class DownloadManager; |
| 35 class DownloadManagerDelegate; | 35 class DownloadManagerDelegate; |
| 36 class GeolocationPermissionContext; | 36 class GeolocationPermissionContext; |
| 37 class IndexedDBContext; | 37 class IndexedDBContext; |
| 38 class MidiPermissionContext; |
| 38 class ResourceContext; | 39 class ResourceContext; |
| 39 class SiteInstance; | 40 class SiteInstance; |
| 40 class StoragePartition; | 41 class StoragePartition; |
| 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. All these methods must only be called on the UI | 44 // It lives on the UI thread. All these methods must only be called on the UI |
| 44 // thread. | 45 // thread. |
| 45 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 46 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
| 46 public: | 47 public: |
| 47 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 48 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // Returns the request context for media resources associated with this | 120 // Returns the request context for media resources associated with this |
| 120 // context and renderer process. | 121 // context and renderer process. |
| 121 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 122 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
| 122 int renderer_child_id) = 0; | 123 int renderer_child_id) = 0; |
| 123 virtual net::URLRequestContextGetter* | 124 virtual net::URLRequestContextGetter* |
| 124 GetMediaRequestContextForStoragePartition( | 125 GetMediaRequestContextForStoragePartition( |
| 125 const base::FilePath& partition_path, | 126 const base::FilePath& partition_path, |
| 126 bool in_memory) = 0; | 127 bool in_memory) = 0; |
| 127 | 128 |
| 128 typedef base::Callback<void(bool)> MIDISysExPermissionCallback; | |
| 129 | |
| 130 // Requests a permission to use system exclusive messages in MIDI events. | |
| 131 // |callback| will be invoked when the request is resolved. | |
| 132 virtual void RequestMIDISysExPermission( | |
| 133 int render_process_id, | |
| 134 int render_view_id, | |
| 135 const GURL& requesting_frame, | |
| 136 const MIDISysExPermissionCallback& callback) = 0; | |
| 137 | |
| 138 // Returns the resource context. | 129 // Returns the resource context. |
| 139 virtual ResourceContext* GetResourceContext() = 0; | 130 virtual ResourceContext* GetResourceContext() = 0; |
| 140 | 131 |
| 141 // Returns the DownloadManagerDelegate for this context. This will be called | 132 // Returns the DownloadManagerDelegate for this context. This will be called |
| 142 // once per context. The embedder owns the delegate and is responsible for | 133 // once per context. The embedder owns the delegate and is responsible for |
| 143 // ensuring that it outlives DownloadManager. It's valid to return NULL. | 134 // ensuring that it outlives DownloadManager. It's valid to return NULL. |
| 144 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | 135 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; |
| 145 | 136 |
| 146 // Returns the geolocation permission context for this context. It's valid to | 137 // Returns the geolocation permission context for this context. It's valid to |
| 147 // return NULL, in which case geolocation requests will always be allowed. | 138 // return NULL, in which case geolocation requests will always be allowed. |
| 148 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | 139 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; |
| 149 | 140 |
| 141 // Returns the MIDI permission context for this context. It's valid to |
| 142 // return NULL, in which case MIDI requests will always be allowed. |
| 143 virtual MidiPermissionContext* GetMidiPermissionContext() = 0; |
| 144 |
| 150 // Returns a special storage policy implementation, or NULL. | 145 // Returns a special storage policy implementation, or NULL. |
| 151 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0; | 146 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() = 0; |
| 152 }; | 147 }; |
| 153 | 148 |
| 154 } // namespace content | 149 } // namespace content |
| 155 | 150 |
| 156 #if defined(COMPILER_GCC) | 151 #if defined(COMPILER_GCC) |
| 157 namespace BASE_HASH_NAMESPACE { | 152 namespace BASE_HASH_NAMESPACE { |
| 158 | 153 |
| 159 template<> | 154 template<> |
| 160 struct hash<content::BrowserContext*> { | 155 struct hash<content::BrowserContext*> { |
| 161 std::size_t operator()(content::BrowserContext* const& p) const { | 156 std::size_t operator()(content::BrowserContext* const& p) const { |
| 162 return reinterpret_cast<std::size_t>(p); | 157 return reinterpret_cast<std::size_t>(p); |
| 163 } | 158 } |
| 164 }; | 159 }; |
| 165 | 160 |
| 166 } // namespace BASE_HASH_NAMESPACE | 161 } // namespace BASE_HASH_NAMESPACE |
| 167 #endif | 162 #endif |
| 168 | 163 |
| 169 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 164 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |