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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 } | 1232 } |
1233 } | 1233 } |
1234 | 1234 |
1235 void DevToolsWindow::OnLoadCompleted() { | 1235 void DevToolsWindow::OnLoadCompleted() { |
1236 // First seed inspected tab id for extension APIs. | 1236 // First seed inspected tab id for extension APIs. |
1237 WebContents* inspected_web_contents = GetInspectedWebContents(); | 1237 WebContents* inspected_web_contents = GetInspectedWebContents(); |
1238 if (inspected_web_contents) { | 1238 if (inspected_web_contents) { |
1239 SessionTabHelper* session_tab_helper = | 1239 SessionTabHelper* session_tab_helper = |
1240 SessionTabHelper::FromWebContents(inspected_web_contents); | 1240 SessionTabHelper::FromWebContents(inspected_web_contents); |
1241 if (session_tab_helper) { | 1241 if (session_tab_helper) { |
1242 base::FundamentalValue tabId(session_tab_helper->session_id().id()); | 1242 base::Value tabId(session_tab_helper->session_id().id()); |
1243 bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId", | 1243 bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId", |
1244 &tabId, NULL, NULL); | 1244 &tabId, NULL, NULL); |
1245 } | 1245 } |
1246 } | 1246 } |
1247 | 1247 |
1248 if (life_stage_ == kClosing) | 1248 if (life_stage_ == kClosing) |
1249 return; | 1249 return; |
1250 | 1250 |
1251 // We could be in kLoadCompleted state already if frontend reloads itself. | 1251 // We could be in kLoadCompleted state already if frontend reloads itself. |
1252 if (life_stage_ != kLoadCompleted) { | 1252 if (life_stage_ != kLoadCompleted) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 case DevToolsToggleAction::kShow: | 1318 case DevToolsToggleAction::kShow: |
1319 case DevToolsToggleAction::kToggle: | 1319 case DevToolsToggleAction::kToggle: |
1320 // Do nothing. | 1320 // Do nothing. |
1321 break; | 1321 break; |
1322 | 1322 |
1323 case DevToolsToggleAction::kReveal: { | 1323 case DevToolsToggleAction::kReveal: { |
1324 const DevToolsToggleAction::RevealParams* params = | 1324 const DevToolsToggleAction::RevealParams* params = |
1325 action.params(); | 1325 action.params(); |
1326 CHECK(params); | 1326 CHECK(params); |
1327 base::StringValue url_value(params->url); | 1327 base::StringValue url_value(params->url); |
1328 base::FundamentalValue line_value(static_cast<int>(params->line_number)); | 1328 base::Value line_value(static_cast<int>(params->line_number)); |
1329 base::FundamentalValue column_value( | 1329 base::Value column_value( |
1330 static_cast<int>(params->column_number)); | 1330 static_cast<int>(params->column_number)); |
1331 bindings_->CallClientFunction("DevToolsAPI.revealSourceLine", | 1331 bindings_->CallClientFunction("DevToolsAPI.revealSourceLine", |
1332 &url_value, &line_value, &column_value); | 1332 &url_value, &line_value, &column_value); |
1333 break; | 1333 break; |
1334 } | 1334 } |
1335 default: | 1335 default: |
1336 NOTREACHED(); | 1336 NOTREACHED(); |
1337 break; | 1337 break; |
1338 } | 1338 } |
1339 } | 1339 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 bool DevToolsWindow::ForwardKeyboardEvent( | 1377 bool DevToolsWindow::ForwardKeyboardEvent( |
1378 const content::NativeWebKeyboardEvent& event) { | 1378 const content::NativeWebKeyboardEvent& event) { |
1379 return event_forwarder_->ForwardEvent(event); | 1379 return event_forwarder_->ForwardEvent(event); |
1380 } | 1380 } |
1381 | 1381 |
1382 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1382 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1383 // Only route reload via front-end if the agent is attached. | 1383 // Only route reload via front-end if the agent is attached. |
1384 WebContents* wc = GetInspectedWebContents(); | 1384 WebContents* wc = GetInspectedWebContents(); |
1385 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1385 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1386 return false; | 1386 return false; |
1387 base::FundamentalValue bypass_cache_value(bypass_cache); | 1387 base::Value bypass_cache_value(bypass_cache); |
1388 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1388 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1389 &bypass_cache_value, nullptr, nullptr); | 1389 &bypass_cache_value, nullptr, nullptr); |
1390 return true; | 1390 return true; |
1391 } | 1391 } |
OLD | NEW |