| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 return NULL; | 192 return NULL; |
| 193 } | 193 } |
| 194 | 194 |
| 195 // static | 195 // static |
| 196 GURL DecorateFrontendURL(const GURL& base_url) { | 196 GURL DecorateFrontendURL(const GURL& base_url) { |
| 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 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 202 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 203 switches::kEnableDevToolsExperiments)) | 203 if (command_line->HasSwitch(switches::kEnableDevToolsExperiments)) |
| 204 url_string += "&experiments=true"; | 204 url_string += "&experiments=true"; |
| 205 |
| 206 if (command_line->HasSwitch(switches::kDevToolsFlags)) { |
| 207 std::string flags = command_line->GetSwitchValueASCII( |
| 208 switches::kDevToolsFlags); |
| 209 flags = net::EscapeQueryParamValue(flags, false); |
| 210 url_string += "&flags=" + flags; |
| 211 } |
| 212 |
| 205 #if defined(DEBUG_DEVTOOLS) | 213 #if defined(DEBUG_DEVTOOLS) |
| 206 url_string += "&debugFrontend=true"; | 214 url_string += "&debugFrontend=true"; |
| 207 #endif // defined(DEBUG_DEVTOOLS) | 215 #endif // defined(DEBUG_DEVTOOLS) |
| 216 |
| 208 return GURL(url_string); | 217 return GURL(url_string); |
| 209 } | 218 } |
| 210 | 219 |
| 211 } // namespace | 220 } // namespace |
| 212 | 221 |
| 213 // DevToolsEventForwarder ----------------------------------------------------- | 222 // DevToolsEventForwarder ----------------------------------------------------- |
| 214 | 223 |
| 215 class DevToolsEventForwarder { | 224 class DevToolsEventForwarder { |
| 216 public: | 225 public: |
| 217 explicit DevToolsEventForwarder(DevToolsWindow* window) | 226 explicit DevToolsEventForwarder(DevToolsWindow* window) |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1370 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
| 1362 // Only route reload via front-end if the agent is attached. | 1371 // Only route reload via front-end if the agent is attached. |
| 1363 WebContents* wc = GetInspectedWebContents(); | 1372 WebContents* wc = GetInspectedWebContents(); |
| 1364 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1373 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
| 1365 return false; | 1374 return false; |
| 1366 base::FundamentalValue bypass_cache_value(bypass_cache); | 1375 base::FundamentalValue bypass_cache_value(bypass_cache); |
| 1367 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1376 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1368 &bypass_cache_value, nullptr, nullptr); | 1377 &bypass_cache_value, nullptr, nullptr); |
| 1369 return true; | 1378 return true; |
| 1370 } | 1379 } |
| OLD | NEW |