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 |
128 ShellURLRequestContextGetter* | 132 ShellURLRequestContextGetter* |
129 ShellBrowserContext::CreateURLRequestContextGetter( | 133 ShellBrowserContext::CreateURLRequestContextGetter( |
130 ProtocolHandlerMap* protocol_handlers, | 134 ProtocolHandlerMap* protocol_handlers, |
131 URLRequestInterceptorScopedVector request_interceptors) { | 135 URLRequestInterceptorScopedVector request_interceptors) { |
132 return new ShellURLRequestContextGetter( | 136 return new ShellURLRequestContextGetter( |
133 ignore_certificate_errors_, GetPath(), | 137 ignore_certificate_errors_, GetPath(), |
134 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 138 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
135 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
136 protocol_handlers, std::move(request_interceptors), net_log_); | 140 protocol_handlers, std::move(request_interceptors), net_log_); |
137 } | 141 } |
138 | 142 |
139 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( | 143 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
140 ProtocolHandlerMap* protocol_handlers, | 144 ProtocolHandlerMap* protocol_handlers, |
141 URLRequestInterceptorScopedVector request_interceptors) { | 145 URLRequestInterceptorScopedVector request_interceptors) { |
142 DCHECK(!url_request_getter_.get()); | 146 DCHECK(!url_request_getter_.get()); |
143 url_request_getter_ = CreateURLRequestContextGetter( | 147 url_request_getter_ = CreateURLRequestContextGetter( |
144 protocol_handlers, std::move(request_interceptors)); | 148 protocol_handlers, std::move(request_interceptors)); |
145 resource_context_->set_url_request_context_getter(url_request_getter_.get()); | 149 resource_context_->set_url_request_context_getter(url_request_getter_.get()); |
146 return url_request_getter_.get(); | 150 return url_request_getter_.get(); |
147 } | 151 } |
148 | 152 |
149 net::URLRequestContextGetter* | 153 net::URLRequestContextGetter* |
150 ShellBrowserContext::GetMediaRequestContext() { | 154 ShellBrowserContext::GetMediaRequestContext() { |
151 return BrowserContext::GetDefaultStoragePartition(this)-> | 155 return GetRequestContext(); |
152 GetURLRequestContext(); | |
153 } | 156 } |
154 | 157 |
155 net::URLRequestContextGetter* | 158 net::URLRequestContextGetter* |
156 ShellBrowserContext::GetMediaRequestContextForRenderProcess( | 159 ShellBrowserContext::GetMediaRequestContextForRenderProcess( |
157 int renderer_child_id) { | 160 int renderer_child_id) { |
158 return BrowserContext::GetDefaultStoragePartition(this)-> | 161 return GetRequestContext(); |
159 GetURLRequestContext(); | |
160 } | 162 } |
161 | 163 |
162 net::URLRequestContextGetter* | 164 net::URLRequestContextGetter* |
163 ShellBrowserContext::GetMediaRequestContextForStoragePartition( | 165 ShellBrowserContext::GetMediaRequestContextForStoragePartition( |
164 const base::FilePath& partition_path, | 166 const base::FilePath& partition_path, |
165 bool in_memory) { | 167 bool in_memory) { |
166 return BrowserContext::GetDefaultStoragePartition(this)-> | 168 return GetRequestContext(); |
167 GetURLRequestContext(); | |
168 } | 169 } |
169 | 170 |
170 net::URLRequestContextGetter* | 171 net::URLRequestContextGetter* |
171 ShellBrowserContext::CreateRequestContextForStoragePartition( | 172 ShellBrowserContext::CreateRequestContextForStoragePartition( |
172 const base::FilePath& partition_path, | 173 const base::FilePath& partition_path, |
173 bool in_memory, | 174 bool in_memory, |
174 ProtocolHandlerMap* protocol_handlers, | 175 ProtocolHandlerMap* protocol_handlers, |
175 URLRequestInterceptorScopedVector request_interceptors) { | 176 URLRequestInterceptorScopedVector request_interceptors) { |
176 return NULL; | 177 return NULL; |
177 } | 178 } |
(...skipping 24 matching lines...) Expand all Loading... |
202 return permission_manager_.get(); | 203 return permission_manager_.get(); |
203 } | 204 } |
204 | 205 |
205 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { | 206 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
206 if (!background_sync_controller_) | 207 if (!background_sync_controller_) |
207 background_sync_controller_.reset(new MockBackgroundSyncController()); | 208 background_sync_controller_.reset(new MockBackgroundSyncController()); |
208 return background_sync_controller_.get(); | 209 return background_sync_controller_.get(); |
209 } | 210 } |
210 | 211 |
211 } // namespace content | 212 } // namespace content |
OLD | NEW |