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 "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 BrowserContext::GetDefaultStoragePartition(browser_context()) | 155 BrowserContext::GetDefaultStoragePartition(browser_context()) |
156 ->GetQuotaManager(), | 156 ->GetQuotaManager(), |
157 BrowserContext::GetDefaultStoragePartition(browser_context()) | 157 BrowserContext::GetDefaultStoragePartition(browser_context()) |
158 ->GetURLRequestContext())); | 158 ->GetURLRequestContext())); |
159 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); | 159 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); |
160 } | 160 } |
161 | 161 |
162 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( | 162 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( |
163 BrowserContext* content_browser_context, | 163 BrowserContext* content_browser_context, |
164 ProtocolHandlerMap* protocol_handlers, | 164 ProtocolHandlerMap* protocol_handlers, |
165 ProtocolHandlerScopedVector protocol_interceptors) { | 165 content::URLRequestInterceptorScopedVector request_interceptors) { |
166 ShellBrowserContext* shell_browser_context = | 166 ShellBrowserContext* shell_browser_context = |
167 ShellBrowserContextForBrowserContext(content_browser_context); | 167 ShellBrowserContextForBrowserContext(content_browser_context); |
168 return shell_browser_context->CreateRequestContext( | 168 return shell_browser_context->CreateRequestContext( |
169 protocol_handlers, protocol_interceptors.Pass()); | 169 protocol_handlers, request_interceptors.Pass()); |
170 } | 170 } |
171 | 171 |
172 net::URLRequestContextGetter* | 172 net::URLRequestContextGetter* |
173 ShellContentBrowserClient::CreateRequestContextForStoragePartition( | 173 ShellContentBrowserClient::CreateRequestContextForStoragePartition( |
174 BrowserContext* content_browser_context, | 174 BrowserContext* content_browser_context, |
175 const base::FilePath& partition_path, | 175 const base::FilePath& partition_path, |
176 bool in_memory, | 176 bool in_memory, |
177 ProtocolHandlerMap* protocol_handlers, | 177 ProtocolHandlerMap* protocol_handlers, |
178 ProtocolHandlerScopedVector protocol_interceptors) { | 178 content::URLRequestInterceptorScopedVector request_interceptors) { |
179 ShellBrowserContext* shell_browser_context = | 179 ShellBrowserContext* shell_browser_context = |
180 ShellBrowserContextForBrowserContext(content_browser_context); | 180 ShellBrowserContextForBrowserContext(content_browser_context); |
181 return shell_browser_context->CreateRequestContextForStoragePartition( | 181 return shell_browser_context->CreateRequestContextForStoragePartition( |
182 partition_path, | 182 partition_path, |
183 in_memory, | 183 in_memory, |
184 protocol_handlers, | 184 protocol_handlers, |
185 protocol_interceptors.Pass()); | 185 request_interceptors.Pass()); |
186 } | 186 } |
187 | 187 |
188 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 188 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
189 if (!url.is_valid()) | 189 if (!url.is_valid()) |
190 return false; | 190 return false; |
191 DCHECK_EQ(url.scheme(), StringToLowerASCII(url.scheme())); | 191 DCHECK_EQ(url.scheme(), StringToLowerASCII(url.scheme())); |
192 // Keep in sync with ProtocolHandlers added by | 192 // Keep in sync with ProtocolHandlers added by |
193 // ShellURLRequestContextGetter::GetURLRequestContext(). | 193 // ShellURLRequestContextGetter::GetURLRequestContext(). |
194 static const char* const kProtocolList[] = { | 194 static const char* const kProtocolList[] = { |
195 kBlobScheme, | 195 kBlobScheme, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 ShellBrowserContext* | 366 ShellBrowserContext* |
367 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 367 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
368 BrowserContext* content_browser_context) { | 368 BrowserContext* content_browser_context) { |
369 if (content_browser_context == browser_context()) | 369 if (content_browser_context == browser_context()) |
370 return browser_context(); | 370 return browser_context(); |
371 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 371 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
372 return off_the_record_browser_context(); | 372 return off_the_record_browser_context(); |
373 } | 373 } |
374 | 374 |
375 } // namespace content | 375 } // namespace content |
OLD | NEW |