| 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 CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // net::URLRequestContextGetter implementation. | 67 // net::URLRequestContextGetter implementation. |
| 68 virtual ChromeURLRequestContext* GetURLRequestContext() OVERRIDE; | 68 virtual ChromeURLRequestContext* GetURLRequestContext() OVERRIDE; |
| 69 virtual scoped_refptr<base::SingleThreadTaskRunner> | 69 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 70 GetNetworkTaskRunner() const OVERRIDE; | 70 GetNetworkTaskRunner() const OVERRIDE; |
| 71 | 71 |
| 72 // Create an instance for use with an 'original' (non-OTR) profile. This is | 72 // Create an instance for use with an 'original' (non-OTR) profile. This is |
| 73 // expected to get called on the UI thread. | 73 // expected to get called on the UI thread. |
| 74 static ChromeURLRequestContextGetter* Create( | 74 static ChromeURLRequestContextGetter* Create( |
| 75 Profile* profile, | 75 Profile* profile, |
| 76 const ProfileIOData* profile_io_data, | 76 const ProfileIOData* profile_io_data, |
| 77 content::ProtocolHandlerMap* protocol_handlers); | 77 content::ProtocolHandlerMap* protocol_handlers, |
| 78 content::ProtocolHandlerScopedVector protocol_interceptors); |
| 78 | 79 |
| 79 // Create an instance for an original profile for media. This is expected to | 80 // Create an instance for an original profile for media. This is expected to |
| 80 // get called on UI thread. This method takes a profile and reuses the | 81 // get called on UI thread. This method takes a profile and reuses the |
| 81 // 'original' net::URLRequestContext for common files. | 82 // 'original' net::URLRequestContext for common files. |
| 82 static ChromeURLRequestContextGetter* CreateForMedia( | 83 static ChromeURLRequestContextGetter* CreateForMedia( |
| 83 Profile* profile, const ProfileIOData* profile_io_data); | 84 Profile* profile, const ProfileIOData* profile_io_data); |
| 84 | 85 |
| 85 // Create an instance for an original profile for extensions. This is expected | 86 // Create an instance for an original profile for extensions. This is expected |
| 86 // to get called on UI thread. | 87 // to get called on UI thread. |
| 87 static ChromeURLRequestContextGetter* CreateForExtensions( | 88 static ChromeURLRequestContextGetter* CreateForExtensions( |
| 88 Profile* profile, const ProfileIOData* profile_io_data); | 89 Profile* profile, const ProfileIOData* profile_io_data); |
| 89 | 90 |
| 90 // Create an instance for an original profile for an app with isolated | 91 // Create an instance for an original profile for an app with isolated |
| 91 // storage. This is expected to get called on UI thread. | 92 // storage. This is expected to get called on UI thread. |
| 92 static ChromeURLRequestContextGetter* CreateForIsolatedApp( | 93 static ChromeURLRequestContextGetter* CreateForIsolatedApp( |
| 93 Profile* profile, | 94 Profile* profile, |
| 94 const ProfileIOData* profile_io_data, | 95 const ProfileIOData* profile_io_data, |
| 95 const StoragePartitionDescriptor& partition_descriptor, | 96 const StoragePartitionDescriptor& partition_descriptor, |
| 96 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 97 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 97 protocol_handler_interceptor, | 98 protocol_handler_interceptor, |
| 98 content::ProtocolHandlerMap* protocol_handlers); | 99 content::ProtocolHandlerMap* protocol_handlers, |
| 100 content::ProtocolHandlerScopedVector protocol_interceptors); |
| 99 | 101 |
| 100 // Create an instance for an original profile for media with isolated | 102 // Create an instance for an original profile for media with isolated |
| 101 // storage. This is expected to get called on UI thread. | 103 // storage. This is expected to get called on UI thread. |
| 102 static ChromeURLRequestContextGetter* CreateForIsolatedMedia( | 104 static ChromeURLRequestContextGetter* CreateForIsolatedMedia( |
| 103 Profile* profile, | 105 Profile* profile, |
| 104 ChromeURLRequestContextGetter* app_context, | 106 ChromeURLRequestContextGetter* app_context, |
| 105 const ProfileIOData* profile_io_data, | 107 const ProfileIOData* profile_io_data, |
| 106 const StoragePartitionDescriptor& partition_descriptor); | 108 const StoragePartitionDescriptor& partition_descriptor); |
| 107 | 109 |
| 108 private: | 110 private: |
| 109 virtual ~ChromeURLRequestContextGetter(); | 111 virtual ~ChromeURLRequestContextGetter(); |
| 110 | 112 |
| 111 // Deferred logic for creating a ChromeURLRequestContext. | 113 // Deferred logic for creating a ChromeURLRequestContext. |
| 112 // Access only from the IO thread. | 114 // Access only from the IO thread. |
| 113 scoped_ptr<ChromeURLRequestContextFactory> factory_; | 115 scoped_ptr<ChromeURLRequestContextFactory> factory_; |
| 114 | 116 |
| 115 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 117 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
| 116 // instance that was lazily created by GetURLRequestContext(). | 118 // instance that was lazily created by GetURLRequestContext(). |
| 117 // Access only from the IO thread. | 119 // Access only from the IO thread. |
| 118 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 120 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
| 119 | 121 |
| 120 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 122 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
| 121 }; | 123 }; |
| 122 | 124 |
| 123 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 125 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |