| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 15 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" | |
| 18 #include "base/supports_user_data.h" | 18 #include "base/supports_user_data.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/public/browser/zoom_level_delegate.h" | 20 #include "content/public/browser/zoom_level_delegate.h" |
| 21 #include "content/public/common/push_event_payload.h" | 21 #include "content/public/common/push_event_payload.h" |
| 22 #include "content/public/common/push_messaging_status.h" | 22 #include "content/public/common/push_messaging_status.h" |
| 23 #include "net/url_request/url_request_interceptor.h" | 23 #include "net/url_request/url_request_interceptor.h" |
| 24 #include "net/url_request/url_request_job_factory.h" | 24 #include "net/url_request/url_request_job_factory.h" |
| 25 | 25 |
| 26 class GURL; | 26 class GURL; |
| 27 | 27 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 class PermissionManager; | 56 class PermissionManager; |
| 57 class PushMessagingService; | 57 class PushMessagingService; |
| 58 class ResourceContext; | 58 class ResourceContext; |
| 59 class ServiceManagerConnection; | 59 class ServiceManagerConnection; |
| 60 class SiteInstance; | 60 class SiteInstance; |
| 61 class StoragePartition; | 61 class StoragePartition; |
| 62 class SSLHostStateDelegate; | 62 class SSLHostStateDelegate; |
| 63 | 63 |
| 64 // A mapping from the scheme name to the protocol handler that services its | 64 // A mapping from the scheme name to the protocol handler that services its |
| 65 // content. | 65 // content. |
| 66 typedef std::map< | 66 using ProtocolHandlerMap = |
| 67 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | 67 std::map<std::string, |
| 68 ProtocolHandlerMap; | 68 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>>; |
| 69 | 69 |
| 70 // A scoped vector of protocol interceptors. | 70 // A owning vector of protocol interceptors. |
| 71 typedef ScopedVector<net::URLRequestInterceptor> | 71 using URLRequestInterceptorScopedVector = |
| 72 URLRequestInterceptorScopedVector; | 72 std::vector<std::unique_ptr<net::URLRequestInterceptor>>; |
| 73 | 73 |
| 74 // This class holds the context needed for a browsing session. | 74 // This class holds the context needed for a browsing session. |
| 75 // It lives on the UI thread. All these methods must only be called on the UI | 75 // It lives on the UI thread. All these methods must only be called on the UI |
| 76 // thread. | 76 // thread. |
| 77 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 77 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
| 78 public: | 78 public: |
| 79 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 79 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
| 80 | 80 |
| 81 // Returns BrowserContext specific external mount points. It may return | 81 // Returns BrowserContext specific external mount points. It may return |
| 82 // nullptr if the context doesn't have any BrowserContext specific external | 82 // nullptr if the context doesn't have any BrowserContext specific external |
| 83 // mount points. Currenty, non-nullptr value is returned only on ChromeOS. | 83 // mount points. Currenty, non-nullptr value is returned only on ChromeOS. |
| 84 static storage::ExternalMountPoints* GetMountPoints(BrowserContext* context); | 84 static storage::ExternalMountPoints* GetMountPoints(BrowserContext* context); |
| 85 | 85 |
| 86 static content::StoragePartition* GetStoragePartition( | 86 static content::StoragePartition* GetStoragePartition( |
| 87 BrowserContext* browser_context, SiteInstance* site_instance); | 87 BrowserContext* browser_context, SiteInstance* site_instance); |
| 88 static content::StoragePartition* GetStoragePartitionForSite( | 88 static content::StoragePartition* GetStoragePartitionForSite( |
| 89 BrowserContext* browser_context, const GURL& site); | 89 BrowserContext* browser_context, const GURL& site); |
| 90 typedef base::Callback<void(StoragePartition*)> StoragePartitionCallback; | 90 using StoragePartitionCallback = base::Callback<void(StoragePartition*)>; |
| 91 static void ForEachStoragePartition( | 91 static void ForEachStoragePartition( |
| 92 BrowserContext* browser_context, | 92 BrowserContext* browser_context, |
| 93 const StoragePartitionCallback& callback); | 93 const StoragePartitionCallback& callback); |
| 94 static void AsyncObliterateStoragePartition( | 94 static void AsyncObliterateStoragePartition( |
| 95 BrowserContext* browser_context, | 95 BrowserContext* browser_context, |
| 96 const GURL& site, | 96 const GURL& site, |
| 97 const base::Closure& on_gc_required); | 97 const base::Closure& on_gc_required); |
| 98 | 98 |
| 99 // This function clears the contents of |active_paths| but does not take | 99 // This function clears the contents of |active_paths| but does not take |
| 100 // ownership of the pointer. | 100 // ownership of the pointer. |
| 101 static void GarbageCollectStoragePartitions( | 101 static void GarbageCollectStoragePartitions( |
| 102 BrowserContext* browser_context, | 102 BrowserContext* browser_context, |
| 103 std::unique_ptr<base::hash_set<base::FilePath>> active_paths, | 103 std::unique_ptr<base::hash_set<base::FilePath>> active_paths, |
| 104 const base::Closure& done); | 104 const base::Closure& done); |
| 105 | 105 |
| 106 static content::StoragePartition* GetDefaultStoragePartition( | 106 static content::StoragePartition* GetDefaultStoragePartition( |
| 107 BrowserContext* browser_context); | 107 BrowserContext* browser_context); |
| 108 | 108 |
| 109 typedef base::Callback<void(std::unique_ptr<BlobHandle>)> BlobCallback; | 109 using BlobCallback = base::Callback<void(std::unique_ptr<BlobHandle>)>; |
| 110 | 110 |
| 111 // |callback| returns a nullptr scoped_ptr on failure. | 111 // |callback| returns a nullptr scoped_ptr on failure. |
| 112 static void CreateMemoryBackedBlob(BrowserContext* browser_context, | 112 static void CreateMemoryBackedBlob(BrowserContext* browser_context, |
| 113 const char* data, size_t length, | 113 const char* data, size_t length, |
| 114 const BlobCallback& callback); | 114 const BlobCallback& callback); |
| 115 | 115 |
| 116 // |callback| returns a nullptr scoped_ptr on failure. | 116 // |callback| returns a nullptr scoped_ptr on failure. |
| 117 static void CreateFileBackedBlob(BrowserContext* browser_context, | 117 static void CreateFileBackedBlob(BrowserContext* browser_context, |
| 118 const base::FilePath& path, | 118 const base::FilePath& path, |
| 119 int64_t offset, | 119 int64_t offset, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // called only once per partition_path. | 242 // called only once per partition_path. |
| 243 virtual net::URLRequestContextGetter* | 243 virtual net::URLRequestContextGetter* |
| 244 CreateMediaRequestContextForStoragePartition( | 244 CreateMediaRequestContextForStoragePartition( |
| 245 const base::FilePath& partition_path, | 245 const base::FilePath& partition_path, |
| 246 bool in_memory) = 0; | 246 bool in_memory) = 0; |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 } // namespace content | 249 } // namespace content |
| 250 | 250 |
| 251 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 251 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |