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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; | 546 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; |
547 base::TimeTicks start_time = base::TimeTicks::Now(); | 547 base::TimeTicks start_time = base::TimeTicks::Now(); |
548 // TODO(loislo): we should initiate DevTools window opening from within | 548 // TODO(loislo): we should initiate DevTools window opening from within |
549 // renderer. Otherwise, we still can hit a race condition here. | 549 // renderer. Otherwise, we still can hit a race condition here. |
550 if (agent->GetType() == content::DevToolsAgentHost::TYPE_WEB_CONTENTS) { | 550 if (agent->GetType() == content::DevToolsAgentHost::TYPE_WEB_CONTENTS) { |
551 OpenDevToolsWindow(agent->GetWebContents()); | 551 OpenDevToolsWindow(agent->GetWebContents()); |
552 } else { | 552 } else { |
553 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()), | 553 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()), |
554 agent); | 554 agent); |
555 } | 555 } |
556 | |
557 agent->InspectElement(x, y); | |
558 | |
559 DevToolsWindow* window = FindDevToolsWindow(agent.get()); | 556 DevToolsWindow* window = FindDevToolsWindow(agent.get()); |
560 if (should_measure_time && window) | 557 if (window) { |
561 window->inspect_element_start_time_ = start_time; | 558 agent->InspectElement(window->bindings_, x, y); |
| 559 if (should_measure_time) |
| 560 window->inspect_element_start_time_ = start_time; |
| 561 } |
562 } | 562 } |
563 | 563 |
564 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { | 564 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { |
565 if (life_stage_ == kLoadCompleted) { | 565 if (life_stage_ == kLoadCompleted) { |
566 Show(action); | 566 Show(action); |
567 return; | 567 return; |
568 } | 568 } |
569 | 569 |
570 // Action will be done only after load completed. | 570 // Action will be done only after load completed. |
571 action_on_load_ = action; | 571 action_on_load_ = action; |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1303 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1304 // Only route reload via front-end if the agent is attached. | 1304 // Only route reload via front-end if the agent is attached. |
1305 WebContents* wc = GetInspectedWebContents(); | 1305 WebContents* wc = GetInspectedWebContents(); |
1306 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1306 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1307 return false; | 1307 return false; |
1308 base::FundamentalValue bypass_cache_value(bypass_cache); | 1308 base::FundamentalValue bypass_cache_value(bypass_cache); |
1309 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1309 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1310 &bypass_cache_value, nullptr, nullptr); | 1310 &bypass_cache_value, nullptr, nullptr); |
1311 return true; | 1311 return true; |
1312 } | 1312 } |
OLD | NEW |