| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 void DevToolsWindow::InspectElement( | 556 void DevToolsWindow::InspectElement( |
| 557 content::RenderFrameHost* inspected_frame_host, | 557 content::RenderFrameHost* inspected_frame_host, |
| 558 int x, | 558 int x, |
| 559 int y) { | 559 int y) { |
| 560 scoped_refptr<DevToolsAgentHost> agent( | 560 scoped_refptr<DevToolsAgentHost> agent( |
| 561 DevToolsAgentHost::GetOrCreateFor(inspected_frame_host)); | 561 DevToolsAgentHost::GetOrCreateFor(inspected_frame_host)); |
| 562 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; | 562 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; |
| 563 base::TimeTicks start_time = base::TimeTicks::Now(); | 563 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 564 // TODO(loislo): we should initiate DevTools window opening from within | 564 // TODO(loislo): we should initiate DevTools window opening from within |
| 565 // renderer. Otherwise, we still can hit a race condition here. | 565 // renderer. Otherwise, we still can hit a race condition here. |
| 566 if (agent->GetType() == content::DevToolsAgentHost::TYPE_WEB_CONTENTS) { | 566 if (agent->GetType() == content::DevToolsAgentHost::kTypePage) { |
| 567 OpenDevToolsWindow(agent->GetWebContents()); | 567 OpenDevToolsWindow(agent->GetWebContents()); |
| 568 } else { | 568 } else { |
| 569 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()), | 569 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()), |
| 570 agent); | 570 agent); |
| 571 } | 571 } |
| 572 DevToolsWindow* window = FindDevToolsWindow(agent.get()); | 572 DevToolsWindow* window = FindDevToolsWindow(agent.get()); |
| 573 if (window) { | 573 if (window) { |
| 574 agent->InspectElement(window->bindings_, x, y); | 574 agent->InspectElement(window->bindings_, x, y); |
| 575 if (should_measure_time) | 575 if (should_measure_time) |
| 576 window->inspect_element_start_time_ = start_time; | 576 window->inspect_element_start_time_ = start_time; |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1321 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
| 1322 // Only route reload via front-end if the agent is attached. | 1322 // Only route reload via front-end if the agent is attached. |
| 1323 WebContents* wc = GetInspectedWebContents(); | 1323 WebContents* wc = GetInspectedWebContents(); |
| 1324 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1324 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
| 1325 return false; | 1325 return false; |
| 1326 base::FundamentalValue bypass_cache_value(bypass_cache); | 1326 base::FundamentalValue bypass_cache_value(bypass_cache); |
| 1327 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1327 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1328 &bypass_cache_value, nullptr, nullptr); | 1328 &bypass_cache_value, nullptr, nullptr); |
| 1329 return true; | 1329 return true; |
| 1330 } | 1330 } |
| OLD | NEW |