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

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

Issue 1433953002: Implement a ShowSecurityPanel() call in the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure the DevTools stays open if ShowSecurityPanel() is called when DevTools is already open. Created 5 years, 1 month 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
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // static 448 // static
449 void DevToolsWindow::ToggleDevToolsWindow( 449 void DevToolsWindow::ToggleDevToolsWindow(
450 Browser* browser, 450 Browser* browser,
451 const DevToolsToggleAction& action) { 451 const DevToolsToggleAction& action) {
452 if (action.type() == DevToolsToggleAction::kToggle && 452 if (action.type() == DevToolsToggleAction::kToggle &&
453 browser->is_devtools()) { 453 browser->is_devtools()) {
454 browser->tab_strip_model()->CloseAllTabs(); 454 browser->tab_strip_model()->CloseAllTabs();
455 return; 455 return;
456 } 456 }
457 457
458 ToggleDevToolsWindow( 458 bool force_open = action.type() == DevToolsToggleAction::kInspect ||
459 browser->tab_strip_model()->GetActiveWebContents(), 459 action.type() == DevToolsToggleAction::kShowSecurityPanel;
pfeldman 2015/11/12 18:58:02 This way it is unclear why Console behaves differe
lgarron 2015/11/13 00:03:38 So, we may or may not need one. The call from //c/
460 action.type() == DevToolsToggleAction::kInspect, 460 ToggleDevToolsWindow(browser->tab_strip_model()->GetActiveWebContents(),
lgarron 2015/11/11 11:01:50 External code can't call this private ToggleDevToo
461 action, ""); 461 force_open, action, "");
462 } 462 }
463 463
464 // static 464 // static
465 void DevToolsWindow::OpenExternalFrontend( 465 void DevToolsWindow::OpenExternalFrontend(
466 Profile* profile, 466 Profile* profile,
467 const std::string& frontend_url, 467 const std::string& frontend_url,
468 const scoped_refptr<content::DevToolsAgentHost>& agent_host, 468 const scoped_refptr<content::DevToolsAgentHost>& agent_host,
469 bool isWorker) { 469 bool isWorker) {
470 DevToolsWindow* window = FindDevToolsWindow(agent_host.get()); 470 DevToolsWindow* window = FindDevToolsWindow(agent_host.get());
471 if (!window) { 471 if (!window) {
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 browser->window() : NULL; 1194 browser->window() : NULL;
1195 } 1195 }
1196 1196
1197 void DevToolsWindow::DoAction(const DevToolsToggleAction& action) { 1197 void DevToolsWindow::DoAction(const DevToolsToggleAction& action) {
1198 switch (action.type()) { 1198 switch (action.type()) {
1199 case DevToolsToggleAction::kShowConsole: 1199 case DevToolsToggleAction::kShowConsole:
1200 bindings_->CallClientFunction( 1200 bindings_->CallClientFunction(
1201 "DevToolsAPI.showConsole", NULL, NULL, NULL); 1201 "DevToolsAPI.showConsole", NULL, NULL, NULL);
1202 break; 1202 break;
1203 1203
1204 case DevToolsToggleAction::kShowSecurityPanel:
1205 bindings_->CallClientFunction("DevToolsAPI.showSecurityPanel", NULL, NULL,
pfeldman 2015/11/12 18:58:02 Lets generalize to "showPanel", "security"
1206 NULL);
1207 break;
1208
1204 case DevToolsToggleAction::kInspect: 1209 case DevToolsToggleAction::kInspect:
1205 bindings_->CallClientFunction( 1210 bindings_->CallClientFunction(
1206 "DevToolsAPI.enterInspectElementMode", NULL, NULL, NULL); 1211 "DevToolsAPI.enterInspectElementMode", NULL, NULL, NULL);
1207 break; 1212 break;
1208 1213
1209 case DevToolsToggleAction::kShow: 1214 case DevToolsToggleAction::kShow:
1210 case DevToolsToggleAction::kToggle: 1215 case DevToolsToggleAction::kToggle:
1211 // Do nothing. 1216 // Do nothing.
1212 break; 1217 break;
1213 1218
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { 1278 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) {
1274 // Only route reload via front-end if the agent is attached. 1279 // Only route reload via front-end if the agent is attached.
1275 WebContents* wc = GetInspectedWebContents(); 1280 WebContents* wc = GetInspectedWebContents();
1276 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1281 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1277 return false; 1282 return false;
1278 base::FundamentalValue ignore_cache_value(ignore_cache); 1283 base::FundamentalValue ignore_cache_value(ignore_cache);
1279 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1284 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1280 &ignore_cache_value, nullptr, nullptr); 1285 &ignore_cache_value, nullptr, nullptr);
1281 return true; 1286 return true;
1282 } 1287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698