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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/common/webrtc_ip_handling_policy.h" | 30 #include "content/public/common/webrtc_ip_handling_policy.h" |
31 #include "content/shell/browser/layout_test/blink_test_controller.h" | 31 #include "content/shell/browser/layout_test/blink_test_controller.h" |
32 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor
y.h" | 32 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor
y.h" |
33 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" | 33 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" |
34 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage
r.h" | 34 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage
r.h" |
35 #include "content/shell/browser/layout_test/secondary_test_window_observer.h" | 35 #include "content/shell/browser/layout_test/secondary_test_window_observer.h" |
36 #include "content/shell/browser/shell_browser_main_parts.h" | 36 #include "content/shell/browser/shell_browser_main_parts.h" |
37 #include "content/shell/browser/shell_content_browser_client.h" | 37 #include "content/shell/browser/shell_content_browser_client.h" |
38 #include "content/shell/browser/shell_devtools_frontend.h" | 38 #include "content/shell/browser/shell_devtools_frontend.h" |
39 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 39 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
| 40 #include "content/shell/common/layout_test/layout_test_switches.h" |
40 #include "content/shell/common/shell_messages.h" | 41 #include "content/shell/common/shell_messages.h" |
41 #include "content/shell/common/shell_switches.h" | 42 #include "content/shell/common/shell_switches.h" |
42 #include "media/media_features.h" | 43 #include "media/media_features.h" |
43 | 44 |
44 namespace content { | 45 namespace content { |
45 | 46 |
46 const int kDefaultTestWindowWidthDip = 800; | 47 const int kDefaultTestWindowWidthDip = 800; |
47 const int kDefaultTestWindowHeightDip = 600; | 48 const int kDefaultTestWindowHeightDip = 600; |
48 | 49 |
49 std::vector<Shell*> Shell::windows_; | 50 std::vector<Shell*> Shell::windows_; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 WebContents* source, | 474 WebContents* source, |
474 const WebContentsUnresponsiveState& unresponsive_state) { | 475 const WebContentsUnresponsiveState& unresponsive_state) { |
475 if (switches::IsRunLayoutTestSwitchPresent()) | 476 if (switches::IsRunLayoutTestSwitchPresent()) |
476 BlinkTestController::Get()->RendererUnresponsive(); | 477 BlinkTestController::Get()->RendererUnresponsive(); |
477 } | 478 } |
478 | 479 |
479 void Shell::ActivateContents(WebContents* contents) { | 480 void Shell::ActivateContents(WebContents* contents) { |
480 contents->GetRenderViewHost()->GetWidget()->Focus(); | 481 contents->GetRenderViewHost()->GetWidget()->Focus(); |
481 } | 482 } |
482 | 483 |
| 484 bool Shell::ShouldAllowRunningInsecureContent( |
| 485 content::WebContents* web_contents, |
| 486 bool allowed_per_prefs, |
| 487 const url::Origin& origin, |
| 488 const GURL& resource_url) { |
| 489 bool allowed_by_test = false; |
| 490 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 491 switches::kRunLayoutTest)) { |
| 492 const base::DictionaryValue& test_flags = |
| 493 BlinkTestController::Get() |
| 494 ->accumulated_layout_test_runtime_flags_changes(); |
| 495 test_flags.GetBoolean("running_insecure_content_allowed", &allowed_by_test); |
| 496 } |
| 497 |
| 498 return allowed_per_prefs || allowed_by_test; |
| 499 } |
| 500 |
483 gfx::Size Shell::GetShellDefaultSize() { | 501 gfx::Size Shell::GetShellDefaultSize() { |
484 static gfx::Size default_shell_size; | 502 static gfx::Size default_shell_size; |
485 if (!default_shell_size.IsEmpty()) | 503 if (!default_shell_size.IsEmpty()) |
486 return default_shell_size; | 504 return default_shell_size; |
487 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 505 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
488 if (command_line->HasSwitch(switches::kContentShellHostWindowSize)) { | 506 if (command_line->HasSwitch(switches::kContentShellHostWindowSize)) { |
489 const std::string size_str = command_line->GetSwitchValueASCII( | 507 const std::string size_str = command_line->GetSwitchValueASCII( |
490 switches::kContentShellHostWindowSize); | 508 switches::kContentShellHostWindowSize); |
491 int width, height; | 509 int width, height; |
492 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); | 510 CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height)); |
493 default_shell_size = gfx::Size(width, height); | 511 default_shell_size = gfx::Size(width, height); |
494 } else { | 512 } else { |
495 default_shell_size = gfx::Size( | 513 default_shell_size = gfx::Size( |
496 kDefaultTestWindowWidthDip, kDefaultTestWindowHeightDip); | 514 kDefaultTestWindowWidthDip, kDefaultTestWindowHeightDip); |
497 } | 515 } |
498 return default_shell_size; | 516 return default_shell_size; |
499 } | 517 } |
500 | 518 |
501 void Shell::TitleWasSet(NavigationEntry* entry, bool explicit_set) { | 519 void Shell::TitleWasSet(NavigationEntry* entry, bool explicit_set) { |
502 if (entry) | 520 if (entry) |
503 PlatformSetTitle(entry->GetTitle()); | 521 PlatformSetTitle(entry->GetTitle()); |
504 } | 522 } |
505 | 523 |
506 void Shell::OnDevToolsWebContentsDestroyed() { | 524 void Shell::OnDevToolsWebContentsDestroyed() { |
507 devtools_observer_.reset(); | 525 devtools_observer_.reset(); |
508 devtools_frontend_ = NULL; | 526 devtools_frontend_ = NULL; |
509 } | 527 } |
510 | 528 |
511 } // namespace content | 529 } // namespace content |
OLD | NEW |