Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 1440383002: [DevTools] Move InspectElement call after OpenDevToolsWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 window->CloseWindow(); 513 window->CloseWindow();
514 } 514 }
515 515
516 // static 516 // static
517 void DevToolsWindow::InspectElement( 517 void DevToolsWindow::InspectElement(
518 content::RenderFrameHost* inspected_frame_host, 518 content::RenderFrameHost* inspected_frame_host,
519 int x, 519 int x,
520 int y) { 520 int y) {
521 scoped_refptr<DevToolsAgentHost> agent( 521 scoped_refptr<DevToolsAgentHost> agent(
522 DevToolsAgentHost::GetOrCreateFor(inspected_frame_host)); 522 DevToolsAgentHost::GetOrCreateFor(inspected_frame_host));
523 agent->InspectElement(x, y);
524 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; 523 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL;
525 base::TimeTicks start_time = base::TimeTicks::Now(); 524 base::TimeTicks start_time = base::TimeTicks::Now();
526 // TODO(loislo): we should initiate DevTools window opening from within 525 // TODO(loislo): we should initiate DevTools window opening from within
527 // renderer. Otherwise, we still can hit a race condition here. 526 // renderer. Otherwise, we still can hit a race condition here.
528 if (agent->GetType() == content::DevToolsAgentHost::TYPE_WEB_CONTENTS) { 527 if (agent->GetType() == content::DevToolsAgentHost::TYPE_WEB_CONTENTS) {
529 OpenDevToolsWindow(agent->GetWebContents()); 528 OpenDevToolsWindow(agent->GetWebContents());
530 } else { 529 } else {
531 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()), 530 OpenDevToolsWindow(Profile::FromBrowserContext(agent->GetBrowserContext()),
532 agent); 531 agent);
533 } 532 }
534 533
534 agent->InspectElement(x, y);
535
535 DevToolsWindow* window = FindDevToolsWindow(agent.get()); 536 DevToolsWindow* window = FindDevToolsWindow(agent.get());
536 if (should_measure_time && window) 537 if (should_measure_time && window)
537 window->inspect_element_start_time_ = start_time; 538 window->inspect_element_start_time_ = start_time;
538 } 539 }
539 540
540 // static 541 // static
541 content::DevToolsExternalAgentProxyDelegate* 542 content::DevToolsExternalAgentProxyDelegate*
542 DevToolsWindow::CreateWebSocketAPIChannel(const std::string& path) { 543 DevToolsWindow::CreateWebSocketAPIChannel(const std::string& path) {
543 if (path.find("/devtools/frontend_api") != 0) 544 if (path.find("/devtools/frontend_api") != 0)
544 return nullptr; 545 return nullptr;
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { 1281 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) {
1281 // Only route reload via front-end if the agent is attached. 1282 // Only route reload via front-end if the agent is attached.
1282 WebContents* wc = GetInspectedWebContents(); 1283 WebContents* wc = GetInspectedWebContents();
1283 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1284 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1284 return false; 1285 return false;
1285 base::FundamentalValue ignore_cache_value(ignore_cache); 1286 base::FundamentalValue ignore_cache_value(ignore_cache);
1286 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1287 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1287 &ignore_cache_value, nullptr, nullptr); 1288 &ignore_cache_value, nullptr, nullptr);
1288 return true; 1289 return true;
1289 } 1290 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/devtools/devtools_agent.cc » ('j') | content/renderer/devtools/devtools_agent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698