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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.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 "content/public/browser/devtools_agent_host.h" | 15 #include "content/public/browser/devtools_manager.h" |
16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
21 #include "content/public/common/renderer_preferences.h" | 21 #include "content/public/common/renderer_preferences.h" |
22 #include "content/shell/browser/notify_done_forwarder.h" | 22 #include "content/shell/browser/notify_done_forwarder.h" |
23 #include "content/shell/browser/shell_browser_main_parts.h" | 23 #include "content/shell/browser/shell_browser_main_parts.h" |
24 #include "content/shell/browser/shell_content_browser_client.h" | 24 #include "content/shell/browser/shell_content_browser_client.h" |
25 #include "content/shell/browser/shell_devtools_frontend.h" | 25 #include "content/shell/browser/shell_devtools_frontend.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 107 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
108 web_contents->GetMutableRendererPrefs()->use_custom_colors = false; | 108 web_contents->GetMutableRendererPrefs()->use_custom_colors = false; |
109 web_contents->GetRenderViewHost()->SyncRendererPrefs(); | 109 web_contents->GetRenderViewHost()->SyncRendererPrefs(); |
110 } | 110 } |
111 | 111 |
112 return shell; | 112 return shell; |
113 } | 113 } |
114 | 114 |
115 void Shell::CloseAllWindows() { | 115 void Shell::CloseAllWindows() { |
116 base::AutoReset<bool> auto_reset(&quit_message_loop_, false); | 116 base::AutoReset<bool> auto_reset(&quit_message_loop_, false); |
117 DevToolsAgentHost::DetachAllClients(); | 117 DevToolsManager::GetInstance()->CloseAllClientHosts(); |
118 std::vector<Shell*> open_windows(windows_); | 118 std::vector<Shell*> open_windows(windows_); |
119 for (size_t i = 0; i < open_windows.size(); ++i) | 119 for (size_t i = 0; i < open_windows.size(); ++i) |
120 open_windows[i]->Close(); | 120 open_windows[i]->Close(); |
121 PlatformExit(); | 121 PlatformExit(); |
122 base::MessageLoop::current()->RunUntilIdle(); | 122 base::MessageLoop::current()->RunUntilIdle(); |
123 } | 123 } |
124 | 124 |
125 void Shell::SetShellCreatedCallback( | 125 void Shell::SetShellCreatedCallback( |
126 base::Callback<void(Shell*)> shell_created_callback) { | 126 base::Callback<void(Shell*)> shell_created_callback) { |
127 DCHECK(shell_created_callback_.is_null()); | 127 DCHECK(shell_created_callback_.is_null()); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 devtools_frontend_->Activate(); | 389 devtools_frontend_->Activate(); |
390 devtools_frontend_->Focus(); | 390 devtools_frontend_->Focus(); |
391 } | 391 } |
392 | 392 |
393 void Shell::OnDevToolsWebContentsDestroyed() { | 393 void Shell::OnDevToolsWebContentsDestroyed() { |
394 devtools_observer_.reset(); | 394 devtools_observer_.reset(); |
395 devtools_frontend_ = NULL; | 395 devtools_frontend_ = NULL; |
396 } | 396 } |
397 | 397 |
398 } // namespace content | 398 } // namespace content |
OLD | NEW |