Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 2403633002: [DevTools] Move sanitize url to devtools_ui.cc. (Closed)
Patch Set: disable test on android and ios - there is no devtools_ui Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { 1369 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) {
1372 // Only route reload via front-end if the agent is attached. 1370 // Only route reload via front-end if the agent is attached.
1373 WebContents* wc = GetInspectedWebContents(); 1371 WebContents* wc = GetInspectedWebContents();
1374 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1372 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1375 return false; 1373 return false;
1376 base::FundamentalValue bypass_cache_value(bypass_cache); 1374 base::FundamentalValue bypass_cache_value(bypass_cache);
1377 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1375 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1378 &bypass_cache_value, nullptr, nullptr); 1376 &bypass_cache_value, nullptr, nullptr);
1379 return true; 1377 return true;
1380 } 1378 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698