| 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.h" | 5 #include "content/shell/browser/shell.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "content/public/browser/devtools_agent_host.h" | 16 #include "content/public/browser/devtools_agent_host.h" |
| 17 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
| 19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "content/public/common/renderer_preferences.h" | 22 #include "content/public/common/renderer_preferences.h" |
| 23 #include "content/shell/browser/blink_test_controller.h" | 23 #include "content/shell/browser/blink_test_controller.h" |
| 24 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor
y.h" |
| 24 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" | 25 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" |
| 25 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage
r.h" | 26 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage
r.h" |
| 26 #include "content/shell/browser/notify_done_forwarder.h" | 27 #include "content/shell/browser/notify_done_forwarder.h" |
| 27 #include "content/shell/browser/shell_browser_main_parts.h" | 28 #include "content/shell/browser/shell_browser_main_parts.h" |
| 28 #include "content/shell/browser/shell_content_browser_client.h" | 29 #include "content/shell/browser/shell_content_browser_client.h" |
| 29 #include "content/shell/browser/shell_devtools_frontend.h" | 30 #include "content/shell/browser/shell_devtools_frontend.h" |
| 30 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 31 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
| 31 #include "content/shell/common/shell_messages.h" | 32 #include "content/shell/common/shell_messages.h" |
| 32 #include "content/shell/common/shell_switches.h" | 33 #include "content/shell/common/shell_switches.h" |
| 33 | 34 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (!dialog_manager_) { | 352 if (!dialog_manager_) { |
| 352 const base::CommandLine& command_line = | 353 const base::CommandLine& command_line = |
| 353 *base::CommandLine::ForCurrentProcess(); | 354 *base::CommandLine::ForCurrentProcess(); |
| 354 dialog_manager_.reset(command_line.HasSwitch(switches::kRunLayoutTest) | 355 dialog_manager_.reset(command_line.HasSwitch(switches::kRunLayoutTest) |
| 355 ? new LayoutTestJavaScriptDialogManager | 356 ? new LayoutTestJavaScriptDialogManager |
| 356 : new ShellJavaScriptDialogManager); | 357 : new ShellJavaScriptDialogManager); |
| 357 } | 358 } |
| 358 return dialog_manager_.get(); | 359 return dialog_manager_.get(); |
| 359 } | 360 } |
| 360 | 361 |
| 362 scoped_ptr<BluetoothChooser> Shell::RunBluetoothChooser( |
| 363 WebContents* web_contents, |
| 364 const BluetoothChooser::EventHandler& event_handler, |
| 365 const GURL& origin) { |
| 366 const base::CommandLine& command_line = |
| 367 *base::CommandLine::ForCurrentProcess(); |
| 368 if (command_line.HasSwitch(switches::kRunLayoutTest)) { |
| 369 return BlinkTestController::Get()->RunBluetoothChooser( |
| 370 web_contents, event_handler, origin); |
| 371 } |
| 372 return nullptr; |
| 373 } |
| 374 |
| 361 bool Shell::AddMessageToConsole(WebContents* source, | 375 bool Shell::AddMessageToConsole(WebContents* source, |
| 362 int32 level, | 376 int32 level, |
| 363 const base::string16& message, | 377 const base::string16& message, |
| 364 int32 line_no, | 378 int32 line_no, |
| 365 const base::string16& source_id) { | 379 const base::string16& source_id) { |
| 366 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 380 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 367 switches::kRunLayoutTest); | 381 switches::kRunLayoutTest); |
| 368 } | 382 } |
| 369 | 383 |
| 370 void Shell::RendererUnresponsive(WebContents* source) { | 384 void Shell::RendererUnresponsive(WebContents* source) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 devtools_frontend_->Activate(); | 433 devtools_frontend_->Activate(); |
| 420 devtools_frontend_->Focus(); | 434 devtools_frontend_->Focus(); |
| 421 } | 435 } |
| 422 | 436 |
| 423 void Shell::OnDevToolsWebContentsDestroyed() { | 437 void Shell::OnDevToolsWebContentsDestroyed() { |
| 424 devtools_observer_.reset(); | 438 devtools_observer_.reset(); |
| 425 devtools_frontend_ = NULL; | 439 devtools_frontend_ = NULL; |
| 426 } | 440 } |
| 427 | 441 |
| 428 } // namespace content | 442 } // namespace content |
| OLD | NEW |