| 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 #include <utility> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 #if defined(USE_AURA) | 70 #if defined(USE_AURA) |
| 71 #include "services/navigation/navigation.h" | 71 #include "services/navigation/navigation.h" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 namespace content { | 74 namespace content { |
| 75 | 75 |
| 76 namespace { | 76 namespace { |
| 77 | 77 |
| 78 ShellContentBrowserClient* g_browser_client; | 78 ShellContentBrowserClient* g_browser_client; |
| 79 bool g_swap_processes_for_redirect = false; | 79 bool g_transfer_all_navigations = false; |
| 80 | 80 |
| 81 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 81 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 82 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( | 82 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( |
| 83 const std::string& process_type) { | 83 const std::string& process_type) { |
| 84 base::FilePath dumps_path = | 84 base::FilePath dumps_path = |
| 85 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 85 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 86 switches::kCrashDumpsDir); | 86 switches::kCrashDumpsDir); |
| 87 { | 87 { |
| 88 ANNOTATE_SCOPED_MEMORY_LEAK; | 88 ANNOTATE_SCOPED_MEMORY_LEAK; |
| 89 breakpad::CrashHandlerHostLinux* crash_handler = | 89 breakpad::CrashHandlerHostLinux* crash_handler = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return -1; | 125 return -1; |
| 126 } | 126 } |
| 127 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 127 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 128 | 128 |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 ShellContentBrowserClient* ShellContentBrowserClient::Get() { | 131 ShellContentBrowserClient* ShellContentBrowserClient::Get() { |
| 132 return g_browser_client; | 132 return g_browser_client; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { | 135 void ShellContentBrowserClient::SetTransferAllNavigations(bool transfer) { |
| 136 g_swap_processes_for_redirect = swap; | 136 g_transfer_all_navigations = transfer; |
| 137 } | 137 } |
| 138 | 138 |
| 139 ShellContentBrowserClient::ShellContentBrowserClient() | 139 ShellContentBrowserClient::ShellContentBrowserClient() |
| 140 : shell_browser_main_parts_(NULL) { | 140 : shell_browser_main_parts_(NULL) { |
| 141 DCHECK(!g_browser_client); | 141 DCHECK(!g_browser_client); |
| 142 g_browser_client = this; | 142 g_browser_client = this; |
| 143 } | 143 } |
| 144 | 144 |
| 145 ShellContentBrowserClient::~ShellContentBrowserClient() { | 145 ShellContentBrowserClient::~ShellContentBrowserClient() { |
| 146 g_browser_client = NULL; | 146 g_browser_client = NULL; |
| 147 } | 147 } |
| 148 | 148 |
| 149 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( | 149 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
| 150 const MainFunctionParams& parameters) { | 150 const MainFunctionParams& parameters) { |
| 151 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); | 151 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); |
| 152 return shell_browser_main_parts_; | 152 return shell_browser_main_parts_; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( | 155 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( |
| 156 BrowserContext* browser_context, | 156 BrowserContext* browser_context, |
| 157 const GURL& effective_site_url) { | 157 const GURL& effective_site_url) { |
| 158 if (g_transfer_all_navigations) |
| 159 return true; |
| 160 |
| 158 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 161 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 159 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); | 162 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); |
| 160 std::string pattern = | 163 std::string pattern = |
| 161 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); | 164 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); |
| 162 | 165 |
| 163 url::Origin origin(effective_site_url); | 166 url::Origin origin(effective_site_url); |
| 164 | 167 |
| 165 if (!origin.unique()) { | 168 if (!origin.unique()) { |
| 166 // Schemes like blob or filesystem, which have an embedded origin, should | 169 // Schemes like blob or filesystem, which have an embedded origin, should |
| 167 // already have been canonicalized to the origin site. | 170 // already have been canonicalized to the origin site. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 313 |
| 311 SpeechRecognitionManagerDelegate* | 314 SpeechRecognitionManagerDelegate* |
| 312 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { | 315 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { |
| 313 return new ShellSpeechRecognitionManagerDelegate(); | 316 return new ShellSpeechRecognitionManagerDelegate(); |
| 314 } | 317 } |
| 315 | 318 |
| 316 net::NetLog* ShellContentBrowserClient::GetNetLog() { | 319 net::NetLog* ShellContentBrowserClient::GetNetLog() { |
| 317 return shell_browser_main_parts_->net_log(); | 320 return shell_browser_main_parts_->net_log(); |
| 318 } | 321 } |
| 319 | 322 |
| 320 bool ShellContentBrowserClient::ShouldSwapProcessesForRedirect( | |
| 321 BrowserContext* browser_context, | |
| 322 const GURL& current_url, | |
| 323 const GURL& new_url) { | |
| 324 return g_swap_processes_for_redirect; | |
| 325 } | |
| 326 | |
| 327 DevToolsManagerDelegate* | 323 DevToolsManagerDelegate* |
| 328 ShellContentBrowserClient::GetDevToolsManagerDelegate() { | 324 ShellContentBrowserClient::GetDevToolsManagerDelegate() { |
| 329 return new ShellDevToolsManagerDelegate(browser_context()); | 325 return new ShellDevToolsManagerDelegate(browser_context()); |
| 330 } | 326 } |
| 331 | 327 |
| 332 void ShellContentBrowserClient::OpenURL( | 328 void ShellContentBrowserClient::OpenURL( |
| 333 BrowserContext* browser_context, | 329 BrowserContext* browser_context, |
| 334 const OpenURLParams& params, | 330 const OpenURLParams& params, |
| 335 const base::Callback<void(WebContents*)>& callback) { | 331 const base::Callback<void(WebContents*)>& callback) { |
| 336 callback.Run(Shell::CreateNewWindow(browser_context, | 332 callback.Run(Shell::CreateNewWindow(browser_context, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 377 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
| 382 return shell_browser_main_parts_->browser_context(); | 378 return shell_browser_main_parts_->browser_context(); |
| 383 } | 379 } |
| 384 | 380 |
| 385 ShellBrowserContext* | 381 ShellBrowserContext* |
| 386 ShellContentBrowserClient::off_the_record_browser_context() { | 382 ShellContentBrowserClient::off_the_record_browser_context() { |
| 387 return shell_browser_main_parts_->off_the_record_browser_context(); | 383 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 388 } | 384 } |
| 389 | 385 |
| 390 } // namespace content | 386 } // namespace content |
| OLD | NEW |