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/render_widget_host.h" | 20 #include "content/public/browser/render_widget_host.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/renderer_preferences.h" | 24 #include "content/public/common/renderer_preferences.h" |
25 #include "content/public/renderer/webrtc_ip_handling_policy.h" | |
25 #include "content/shell/browser/blink_test_controller.h" | 26 #include "content/shell/browser/blink_test_controller.h" |
26 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor y.h" | 27 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor y.h" |
27 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" | 28 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" |
28 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage r.h" | 29 #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manage r.h" |
29 #include "content/shell/browser/notify_done_forwarder.h" | 30 #include "content/shell/browser/notify_done_forwarder.h" |
30 #include "content/shell/browser/shell_browser_main_parts.h" | 31 #include "content/shell/browser/shell_browser_main_parts.h" |
31 #include "content/shell/browser/shell_content_browser_client.h" | 32 #include "content/shell/browser/shell_content_browser_client.h" |
32 #include "content/shell/browser/shell_devtools_frontend.h" | 33 #include "content/shell/browser/shell_devtools_frontend.h" |
33 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 34 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
34 #include "content/shell/common/shell_messages.h" | 35 #include "content/shell/common/shell_messages.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 114 |
114 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 115 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
115 switches::kRunLayoutTest)) { | 116 switches::kRunLayoutTest)) { |
116 web_contents->GetMutableRendererPrefs()->use_custom_colors = false; | 117 web_contents->GetMutableRendererPrefs()->use_custom_colors = false; |
117 web_contents->GetRenderViewHost()->SyncRendererPrefs(); | 118 web_contents->GetRenderViewHost()->SyncRendererPrefs(); |
118 } | 119 } |
119 | 120 |
120 #if defined(ENABLE_WEBRTC) | 121 #if defined(ENABLE_WEBRTC) |
121 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 122 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
122 switches::kDisableWebRtcMultipleRoutes)) { | 123 switches::kDisableWebRtcMultipleRoutes)) { |
123 web_contents->GetMutableRendererPrefs()->enable_webrtc_multiple_routes = | 124 web_contents->GetMutableRendererPrefs()->webrtc_ip_handling_policy = |
124 false; | 125 content::kWebRTCIPHandlingDefaultPublicInterfaceOnly; |
nasko
2015/10/26 15:49:49
This code is already in content/. No need for cont
guoweis_left_chromium
2015/10/27 20:32:00
Done.
| |
125 } | 126 } |
126 #endif | 127 #endif |
127 | 128 |
128 return shell; | 129 return shell; |
129 } | 130 } |
130 | 131 |
131 void Shell::CloseAllWindows() { | 132 void Shell::CloseAllWindows() { |
132 base::AutoReset<bool> auto_reset(&quit_message_loop_, false); | 133 base::AutoReset<bool> auto_reset(&quit_message_loop_, false); |
133 DevToolsAgentHost::DetachAllClients(); | 134 DevToolsAgentHost::DetachAllClients(); |
134 std::vector<Shell*> open_windows(windows_); | 135 std::vector<Shell*> open_windows(windows_); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 devtools_frontend_->Activate(); | 440 devtools_frontend_->Activate(); |
440 devtools_frontend_->Focus(); | 441 devtools_frontend_->Focus(); |
441 } | 442 } |
442 | 443 |
443 void Shell::OnDevToolsWebContentsDestroyed() { | 444 void Shell::OnDevToolsWebContentsDestroyed() { |
444 devtools_observer_.reset(); | 445 devtools_observer_.reset(); |
445 devtools_frontend_ = NULL; | 446 devtools_frontend_ = NULL; |
446 } | 447 } |
447 | 448 |
448 } // namespace content | 449 } // namespace content |
OLD | NEW |