| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/shell/browser/shell_browser_context.h" | 5 #include "content/shell/browser/shell_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { | 118 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
| 119 if (!download_manager_delegate_.get()) { | 119 if (!download_manager_delegate_.get()) { |
| 120 download_manager_delegate_.reset(new ShellDownloadManagerDelegate()); | 120 download_manager_delegate_.reset(new ShellDownloadManagerDelegate()); |
| 121 download_manager_delegate_->SetDownloadManager( | 121 download_manager_delegate_->SetDownloadManager( |
| 122 BrowserContext::GetDownloadManager(this)); | 122 BrowserContext::GetDownloadManager(this)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 return download_manager_delegate_.get(); | 125 return download_manager_delegate_.get(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { | |
| 129 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | |
| 130 } | |
| 131 | |
| 132 ShellURLRequestContextGetter* | 128 ShellURLRequestContextGetter* |
| 133 ShellBrowserContext::CreateURLRequestContextGetter( | 129 ShellBrowserContext::CreateURLRequestContextGetter( |
| 134 ProtocolHandlerMap* protocol_handlers, | 130 ProtocolHandlerMap* protocol_handlers, |
| 135 URLRequestInterceptorScopedVector request_interceptors) { | 131 URLRequestInterceptorScopedVector request_interceptors) { |
| 136 return new ShellURLRequestContextGetter( | 132 return new ShellURLRequestContextGetter( |
| 137 ignore_certificate_errors_, GetPath(), | 133 ignore_certificate_errors_, GetPath(), |
| 138 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 134 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 135 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 140 protocol_handlers, std::move(request_interceptors), net_log_); | 136 protocol_handlers, std::move(request_interceptors), net_log_); |
| 141 } | 137 } |
| 142 | 138 |
| 143 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( | 139 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
| 144 ProtocolHandlerMap* protocol_handlers, | 140 ProtocolHandlerMap* protocol_handlers, |
| 145 URLRequestInterceptorScopedVector request_interceptors) { | 141 URLRequestInterceptorScopedVector request_interceptors) { |
| 146 DCHECK(!url_request_getter_.get()); | 142 DCHECK(!url_request_getter_.get()); |
| 147 url_request_getter_ = CreateURLRequestContextGetter( | 143 url_request_getter_ = CreateURLRequestContextGetter( |
| 148 protocol_handlers, std::move(request_interceptors)); | 144 protocol_handlers, std::move(request_interceptors)); |
| 149 resource_context_->set_url_request_context_getter(url_request_getter_.get()); | 145 resource_context_->set_url_request_context_getter(url_request_getter_.get()); |
| 150 return url_request_getter_.get(); | 146 return url_request_getter_.get(); |
| 151 } | 147 } |
| 152 | 148 |
| 153 net::URLRequestContextGetter* | 149 net::URLRequestContextGetter* |
| 154 ShellBrowserContext::GetMediaRequestContext() { | 150 ShellBrowserContext::GetMediaRequestContext() { |
| 155 return GetRequestContext(); | 151 return BrowserContext::GetDefaultStoragePartition(this)-> |
| 152 GetURLRequestContext(); |
| 156 } | 153 } |
| 157 | 154 |
| 158 net::URLRequestContextGetter* | 155 net::URLRequestContextGetter* |
| 159 ShellBrowserContext::GetMediaRequestContextForRenderProcess( | 156 ShellBrowserContext::GetMediaRequestContextForRenderProcess( |
| 160 int renderer_child_id) { | 157 int renderer_child_id) { |
| 161 return GetRequestContext(); | 158 return BrowserContext::GetDefaultStoragePartition(this)-> |
| 159 GetURLRequestContext(); |
| 162 } | 160 } |
| 163 | 161 |
| 164 net::URLRequestContextGetter* | 162 net::URLRequestContextGetter* |
| 165 ShellBrowserContext::GetMediaRequestContextForStoragePartition( | 163 ShellBrowserContext::GetMediaRequestContextForStoragePartition( |
| 166 const base::FilePath& partition_path, | 164 const base::FilePath& partition_path, |
| 167 bool in_memory) { | 165 bool in_memory) { |
| 168 return GetRequestContext(); | 166 return BrowserContext::GetDefaultStoragePartition(this)-> |
| 167 GetURLRequestContext(); |
| 169 } | 168 } |
| 170 | 169 |
| 171 net::URLRequestContextGetter* | 170 net::URLRequestContextGetter* |
| 172 ShellBrowserContext::CreateRequestContextForStoragePartition( | 171 ShellBrowserContext::CreateRequestContextForStoragePartition( |
| 173 const base::FilePath& partition_path, | 172 const base::FilePath& partition_path, |
| 174 bool in_memory, | 173 bool in_memory, |
| 175 ProtocolHandlerMap* protocol_handlers, | 174 ProtocolHandlerMap* protocol_handlers, |
| 176 URLRequestInterceptorScopedVector request_interceptors) { | 175 URLRequestInterceptorScopedVector request_interceptors) { |
| 177 return NULL; | 176 return NULL; |
| 178 } | 177 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 203 return permission_manager_.get(); | 202 return permission_manager_.get(); |
| 204 } | 203 } |
| 205 | 204 |
| 206 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { | 205 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
| 207 if (!background_sync_controller_) | 206 if (!background_sync_controller_) |
| 208 background_sync_controller_.reset(new MockBackgroundSyncController()); | 207 background_sync_controller_.reset(new MockBackgroundSyncController()); |
| 209 return background_sync_controller_.get(); | 208 return background_sync_controller_.get(); |
| 210 } | 209 } |
| 211 | 210 |
| 212 } // namespace content | 211 } // namespace content |
| OLD | NEW |