| 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/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "content/public/browser/page_navigator.h" |
| 13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/browser/resource_dispatcher_host.h" | 15 #include "content/public/browser/resource_dispatcher_host.h" |
| 15 #include "content/public/browser/storage_partition.h" | 16 #include "content/public/browser/storage_partition.h" |
| 16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 17 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 18 #include "content/public/common/web_preferences.h" | 19 #include "content/public/common/web_preferences.h" |
| 19 #include "content/shell/browser/ipc_echo_message_filter.h" | 20 #include "content/shell/browser/ipc_echo_message_filter.h" |
| 20 #include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" | 21 #include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" |
| 21 #include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host
_delegate.h" | 22 #include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host
_delegate.h" |
| 22 #include "content/shell/browser/shell.h" | 23 #include "content/shell/browser/shell.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 const GURL& current_url, | 296 const GURL& current_url, |
| 296 const GURL& new_url) { | 297 const GURL& new_url) { |
| 297 return g_swap_processes_for_redirect; | 298 return g_swap_processes_for_redirect; |
| 298 } | 299 } |
| 299 | 300 |
| 300 DevToolsManagerDelegate* | 301 DevToolsManagerDelegate* |
| 301 ShellContentBrowserClient::GetDevToolsManagerDelegate() { | 302 ShellContentBrowserClient::GetDevToolsManagerDelegate() { |
| 302 return new ShellDevToolsManagerDelegate(browser_context()); | 303 return new ShellDevToolsManagerDelegate(browser_context()); |
| 303 } | 304 } |
| 304 | 305 |
| 306 WebContents* ShellContentBrowserClient::OpenURL(BrowserContext* browser_context, |
| 307 const OpenURLParams& params) { |
| 308 return Shell::CreateNewWindow(browser_context, |
| 309 params.url, |
| 310 nullptr, |
| 311 gfx::Size())->web_contents(); |
| 312 } |
| 313 |
| 305 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 314 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 306 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 315 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 307 const base::CommandLine& command_line, | 316 const base::CommandLine& command_line, |
| 308 int child_process_id, | 317 int child_process_id, |
| 309 FileDescriptorInfo* mappings) { | 318 FileDescriptorInfo* mappings) { |
| 310 #if defined(OS_ANDROID) | 319 #if defined(OS_ANDROID) |
| 311 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 320 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| 312 base::FilePath pak_file; | 321 base::FilePath pak_file; |
| 313 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); | 322 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); |
| 314 CHECK(r); | 323 CHECK(r); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 ShellBrowserContext* | 384 ShellBrowserContext* |
| 376 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 385 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 377 BrowserContext* content_browser_context) { | 386 BrowserContext* content_browser_context) { |
| 378 if (content_browser_context == browser_context()) | 387 if (content_browser_context == browser_context()) |
| 379 return browser_context(); | 388 return browser_context(); |
| 380 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 389 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 381 return off_the_record_browser_context(); | 390 return off_the_record_browser_context(); |
| 382 } | 391 } |
| 383 | 392 |
| 384 } // namespace content | 393 } // namespace content |
| OLD | NEW |