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_content_browser_client.h" | 5 #include "content/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/files/file.h" | 12 #include "base/files/file.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/strings/pattern.h" | 16 #include "base/strings/pattern.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return base::MatchPattern(origin, pattern); | 166 return base::MatchPattern(origin, pattern); |
166 } | 167 } |
167 | 168 |
168 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( | 169 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( |
169 BrowserContext* content_browser_context, | 170 BrowserContext* content_browser_context, |
170 ProtocolHandlerMap* protocol_handlers, | 171 ProtocolHandlerMap* protocol_handlers, |
171 URLRequestInterceptorScopedVector request_interceptors) { | 172 URLRequestInterceptorScopedVector request_interceptors) { |
172 ShellBrowserContext* shell_browser_context = | 173 ShellBrowserContext* shell_browser_context = |
173 ShellBrowserContextForBrowserContext(content_browser_context); | 174 ShellBrowserContextForBrowserContext(content_browser_context); |
174 return shell_browser_context->CreateRequestContext( | 175 return shell_browser_context->CreateRequestContext( |
175 protocol_handlers, request_interceptors.Pass()); | 176 protocol_handlers, std::move(request_interceptors)); |
176 } | 177 } |
177 | 178 |
178 net::URLRequestContextGetter* | 179 net::URLRequestContextGetter* |
179 ShellContentBrowserClient::CreateRequestContextForStoragePartition( | 180 ShellContentBrowserClient::CreateRequestContextForStoragePartition( |
180 BrowserContext* content_browser_context, | 181 BrowserContext* content_browser_context, |
181 const base::FilePath& partition_path, | 182 const base::FilePath& partition_path, |
182 bool in_memory, | 183 bool in_memory, |
183 ProtocolHandlerMap* protocol_handlers, | 184 ProtocolHandlerMap* protocol_handlers, |
184 URLRequestInterceptorScopedVector request_interceptors) { | 185 URLRequestInterceptorScopedVector request_interceptors) { |
185 ShellBrowserContext* shell_browser_context = | 186 ShellBrowserContext* shell_browser_context = |
186 ShellBrowserContextForBrowserContext(content_browser_context); | 187 ShellBrowserContextForBrowserContext(content_browser_context); |
187 return shell_browser_context->CreateRequestContextForStoragePartition( | 188 return shell_browser_context->CreateRequestContextForStoragePartition( |
188 partition_path, | 189 partition_path, in_memory, protocol_handlers, |
189 in_memory, | 190 std::move(request_interceptors)); |
190 protocol_handlers, | |
191 request_interceptors.Pass()); | |
192 } | 191 } |
193 | 192 |
194 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 193 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
195 if (!url.is_valid()) | 194 if (!url.is_valid()) |
196 return false; | 195 return false; |
197 // Keep in sync with ProtocolHandlers added by | 196 // Keep in sync with ProtocolHandlers added by |
198 // ShellURLRequestContextGetter::GetURLRequestContext(). | 197 // ShellURLRequestContextGetter::GetURLRequestContext(). |
199 static const char* const kProtocolList[] = { | 198 static const char* const kProtocolList[] = { |
200 url::kBlobScheme, | 199 url::kBlobScheme, |
201 url::kFileSystemScheme, | 200 url::kFileSystemScheme, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 ShellBrowserContext* | 431 ShellBrowserContext* |
433 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 432 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
434 BrowserContext* content_browser_context) { | 433 BrowserContext* content_browser_context) { |
435 if (content_browser_context == browser_context()) | 434 if (content_browser_context == browser_context()) |
436 return browser_context(); | 435 return browser_context(); |
437 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 436 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
438 return off_the_record_browser_context(); | 437 return off_the_record_browser_context(); |
439 } | 438 } |
440 | 439 |
441 } // namespace content | 440 } // namespace content |
OLD | NEW |