| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/devtools/devtools_window.h" | 5 #include "chrome/browser/devtools/devtools_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 std::string frontend_url = base_url.spec(); | 197 std::string frontend_url = base_url.spec(); |
| 198 std::string url_string( | 198 std::string url_string( |
| 199 frontend_url + | 199 frontend_url + |
| 200 ((frontend_url.find("?") == std::string::npos) ? "?" : "&") + | 200 ((frontend_url.find("?") == std::string::npos) ? "?" : "&") + |
| 201 "dockSide=undocked"); // TODO(dgozman): remove this support in M38. | 201 "dockSide=undocked"); // TODO(dgozman): remove this support in M38. |
| 202 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 202 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 203 if (command_line->HasSwitch(switches::kEnableDevToolsExperiments)) | 203 if (command_line->HasSwitch(switches::kEnableDevToolsExperiments)) |
| 204 url_string += "&experiments=true"; | 204 url_string += "&experiments=true"; |
| 205 | 205 |
| 206 if (command_line->HasSwitch(switches::kDevToolsFlags)) { | 206 if (command_line->HasSwitch(switches::kDevToolsFlags)) { |
| 207 std::string flags = command_line->GetSwitchValueASCII( | 207 url_string += "&" + command_line->GetSwitchValueASCII( |
| 208 switches::kDevToolsFlags); | 208 switches::kDevToolsFlags); |
| 209 flags = net::EscapeQueryParamValue(flags, false); | |
| 210 url_string += "&flags=" + flags; | |
| 211 } | 209 } |
| 212 | 210 |
| 213 #if defined(DEBUG_DEVTOOLS) | 211 #if defined(DEBUG_DEVTOOLS) |
| 214 url_string += "&debugFrontend=true"; | 212 url_string += "&debugFrontend=true"; |
| 215 #endif // defined(DEBUG_DEVTOOLS) | 213 #endif // defined(DEBUG_DEVTOOLS) |
| 216 | 214 |
| 217 return GURL(url_string); | 215 return GURL(url_string); |
| 218 } | 216 } |
| 219 | 217 |
| 220 } // namespace | 218 } // namespace |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 url_string += "&isSharedWorker=true"; | 893 url_string += "&isSharedWorker=true"; |
| 896 if (v8_only_frontend) | 894 if (v8_only_frontend) |
| 897 url_string += "&v8only=true"; | 895 url_string += "&v8only=true"; |
| 898 if (remote_frontend.size()) { | 896 if (remote_frontend.size()) { |
| 899 url_string += "&remoteFrontend=true"; | 897 url_string += "&remoteFrontend=true"; |
| 900 } else { | 898 } else { |
| 901 url_string += "&remoteBase=" + DevToolsUI::GetRemoteBaseURL().spec(); | 899 url_string += "&remoteBase=" + DevToolsUI::GetRemoteBaseURL().spec(); |
| 902 } | 900 } |
| 903 if (can_dock) | 901 if (can_dock) |
| 904 url_string += "&can_dock=true"; | 902 url_string += "&can_dock=true"; |
| 905 return GURL(url_string); | 903 return DevToolsUI::SanitizeFrontendURL(GURL(url_string)); |
| 906 } | 904 } |
| 907 | 905 |
| 908 // static | 906 // static |
| 909 DevToolsWindow* DevToolsWindow::FindDevToolsWindow( | 907 DevToolsWindow* DevToolsWindow::FindDevToolsWindow( |
| 910 DevToolsAgentHost* agent_host) { | 908 DevToolsAgentHost* agent_host) { |
| 911 if (!agent_host || g_instances == NULL) | 909 if (!agent_host || g_instances == NULL) |
| 912 return NULL; | 910 return NULL; |
| 913 DevToolsWindows* instances = g_instances.Pointer(); | 911 DevToolsWindows* instances = g_instances.Pointer(); |
| 914 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); | 912 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); |
| 915 ++it) { | 913 ++it) { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1375 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
| 1378 // Only route reload via front-end if the agent is attached. | 1376 // Only route reload via front-end if the agent is attached. |
| 1379 WebContents* wc = GetInspectedWebContents(); | 1377 WebContents* wc = GetInspectedWebContents(); |
| 1380 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1378 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
| 1381 return false; | 1379 return false; |
| 1382 base::FundamentalValue bypass_cache_value(bypass_cache); | 1380 base::FundamentalValue bypass_cache_value(bypass_cache); |
| 1383 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1381 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1384 &bypass_cache_value, nullptr, nullptr); | 1382 &bypass_cache_value, nullptr, nullptr); |
| 1385 return true; | 1383 return true; |
| 1386 } | 1384 } |
| OLD | NEW |