| 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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { | 1189 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { |
| 1190 Browser* browser = NULL; | 1190 Browser* browser = NULL; |
| 1191 int tab; | 1191 int tab; |
| 1192 return FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), | 1192 return FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), |
| 1193 &browser, &tab) ? | 1193 &browser, &tab) ? |
| 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 base::StringValue panel_name("console"); |
| 1201 "DevToolsAPI.showConsole", NULL, NULL, NULL); | 1201 bindings_->CallClientFunction("DevToolsAPI.showPanel", &panel_name, NULL, |
| 1202 NULL); |
| 1202 break; | 1203 break; |
| 1203 | 1204 } |
| 1205 case DevToolsToggleAction::kShowSecurityPanel: { |
| 1206 base::StringValue panel_name("security"); |
| 1207 bindings_->CallClientFunction("DevToolsAPI.showPanel", &panel_name, NULL, |
| 1208 NULL); |
| 1209 break; |
| 1210 } |
| 1204 case DevToolsToggleAction::kInspect: | 1211 case DevToolsToggleAction::kInspect: |
| 1205 bindings_->CallClientFunction( | 1212 bindings_->CallClientFunction( |
| 1206 "DevToolsAPI.enterInspectElementMode", NULL, NULL, NULL); | 1213 "DevToolsAPI.enterInspectElementMode", NULL, NULL, NULL); |
| 1207 break; | 1214 break; |
| 1208 | 1215 |
| 1209 case DevToolsToggleAction::kShow: | 1216 case DevToolsToggleAction::kShow: |
| 1210 case DevToolsToggleAction::kToggle: | 1217 case DevToolsToggleAction::kToggle: |
| 1211 // Do nothing. | 1218 // Do nothing. |
| 1212 break; | 1219 break; |
| 1213 | 1220 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { | 1280 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { |
| 1274 // Only route reload via front-end if the agent is attached. | 1281 // Only route reload via front-end if the agent is attached. |
| 1275 WebContents* wc = GetInspectedWebContents(); | 1282 WebContents* wc = GetInspectedWebContents(); |
| 1276 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1283 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
| 1277 return false; | 1284 return false; |
| 1278 base::FundamentalValue ignore_cache_value(ignore_cache); | 1285 base::FundamentalValue ignore_cache_value(ignore_cache); |
| 1279 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1286 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1280 &ignore_cache_value, nullptr, nullptr); | 1287 &ignore_cache_value, nullptr, nullptr); |
| 1281 return true; | 1288 return true; |
| 1282 } | 1289 } |
| OLD | NEW |