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

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

Issue 2161493002: [DevTools] Pass client initiating DevToolsAgentHost::inspectElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DevToolsWindow* window = FindDevToolsWindow(agent.get());
557 if (window)
558 agent->InspectElement(window->bindings_, x, y);
556 559
557 agent->InspectElement(x, y);
558
559 DevToolsWindow* window = FindDevToolsWindow(agent.get());
560 if (should_measure_time && window) 560 if (should_measure_time && window)
Tom Sepez 2016/07/18 16:15:49 nit: combine with above to avoid re-testing |windo
dgozman 2016/07/18 19:55:58 Done.
561 window->inspect_element_start_time_ = start_time; 561 window->inspect_element_start_time_ = start_time;
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.
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/devtools_agent_host_impl.h » ('j') | content/common/devtools_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698