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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1270 } |
1271 } | 1271 } |
1272 | 1272 |
1273 void DevToolsWindow::OnLoadCompleted() { | 1273 void DevToolsWindow::OnLoadCompleted() { |
1274 // First seed inspected tab id for extension APIs. | 1274 // First seed inspected tab id for extension APIs. |
1275 WebContents* inspected_web_contents = GetInspectedWebContents(); | 1275 WebContents* inspected_web_contents = GetInspectedWebContents(); |
1276 if (inspected_web_contents) { | 1276 if (inspected_web_contents) { |
1277 SessionTabHelper* session_tab_helper = | 1277 SessionTabHelper* session_tab_helper = |
1278 SessionTabHelper::FromWebContents(inspected_web_contents); | 1278 SessionTabHelper::FromWebContents(inspected_web_contents); |
1279 if (session_tab_helper) { | 1279 if (session_tab_helper) { |
1280 base::FundamentalValue tabId(session_tab_helper->session_id().id()); | 1280 base::Value tabId(session_tab_helper->session_id().id()); |
1281 bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId", | 1281 bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId", |
1282 &tabId, NULL, NULL); | 1282 &tabId, NULL, NULL); |
1283 } | 1283 } |
1284 } | 1284 } |
1285 | 1285 |
1286 if (life_stage_ == kClosing) | 1286 if (life_stage_ == kClosing) |
1287 return; | 1287 return; |
1288 | 1288 |
1289 // We could be in kLoadCompleted state already if frontend reloads itself. | 1289 // We could be in kLoadCompleted state already if frontend reloads itself. |
1290 if (life_stage_ != kLoadCompleted) { | 1290 if (life_stage_ != kLoadCompleted) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 case DevToolsToggleAction::kShow: | 1346 case DevToolsToggleAction::kShow: |
1347 case DevToolsToggleAction::kToggle: | 1347 case DevToolsToggleAction::kToggle: |
1348 // Do nothing. | 1348 // Do nothing. |
1349 break; | 1349 break; |
1350 | 1350 |
1351 case DevToolsToggleAction::kReveal: { | 1351 case DevToolsToggleAction::kReveal: { |
1352 const DevToolsToggleAction::RevealParams* params = | 1352 const DevToolsToggleAction::RevealParams* params = |
1353 action.params(); | 1353 action.params(); |
1354 CHECK(params); | 1354 CHECK(params); |
1355 base::StringValue url_value(params->url); | 1355 base::StringValue url_value(params->url); |
1356 base::FundamentalValue line_value(static_cast<int>(params->line_number)); | 1356 base::Value line_value(static_cast<int>(params->line_number)); |
1357 base::FundamentalValue column_value( | 1357 base::Value column_value(static_cast<int>(params->column_number)); |
1358 static_cast<int>(params->column_number)); | |
1359 bindings_->CallClientFunction("DevToolsAPI.revealSourceLine", | 1358 bindings_->CallClientFunction("DevToolsAPI.revealSourceLine", |
1360 &url_value, &line_value, &column_value); | 1359 &url_value, &line_value, &column_value); |
1361 break; | 1360 break; |
1362 } | 1361 } |
1363 default: | 1362 default: |
1364 NOTREACHED(); | 1363 NOTREACHED(); |
1365 break; | 1364 break; |
1366 } | 1365 } |
1367 } | 1366 } |
1368 | 1367 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 bool DevToolsWindow::ForwardKeyboardEvent( | 1404 bool DevToolsWindow::ForwardKeyboardEvent( |
1406 const content::NativeWebKeyboardEvent& event) { | 1405 const content::NativeWebKeyboardEvent& event) { |
1407 return event_forwarder_->ForwardEvent(event); | 1406 return event_forwarder_->ForwardEvent(event); |
1408 } | 1407 } |
1409 | 1408 |
1410 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1409 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1411 // Only route reload via front-end if the agent is attached. | 1410 // Only route reload via front-end if the agent is attached. |
1412 WebContents* wc = GetInspectedWebContents(); | 1411 WebContents* wc = GetInspectedWebContents(); |
1413 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1412 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1414 return false; | 1413 return false; |
1415 base::FundamentalValue bypass_cache_value(bypass_cache); | 1414 base::Value bypass_cache_value(bypass_cache); |
1416 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1415 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1417 &bypass_cache_value, nullptr, nullptr); | 1416 &bypass_cache_value, nullptr, nullptr); |
1418 return true; | 1417 return true; |
1419 } | 1418 } |
OLD | NEW |