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

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

Issue 1828983002: Revert of [DevTools] Use InspectorFrontendHost.readyForTest for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ready-for-test
Patch Set: Created 4 years, 9 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 toolbox_web_contents_(nullptr), 709 toolbox_web_contents_(nullptr),
710 bindings_(bindings), 710 bindings_(bindings),
711 browser_(nullptr), 711 browser_(nullptr),
712 is_docked_(true), 712 is_docked_(true),
713 can_dock_(can_dock), 713 can_dock_(can_dock),
714 // This initialization allows external front-end to work without changes. 714 // This initialization allows external front-end to work without changes.
715 // We don't wait for docking call, but instead immediately show undocked. 715 // We don't wait for docking call, but instead immediately show undocked.
716 // Passing "dockSide=undocked" parameter ensures proper UI. 716 // Passing "dockSide=undocked" parameter ensures proper UI.
717 life_stage_(can_dock ? kNotLoaded : kIsDockedSet), 717 life_stage_(can_dock ? kNotLoaded : kIsDockedSet),
718 action_on_load_(DevToolsToggleAction::NoOp()), 718 action_on_load_(DevToolsToggleAction::NoOp()),
719 intercepted_page_beforeunload_(false), 719 intercepted_page_beforeunload_(false) {
720 ready_for_test_(false) {
721 // Set up delegate, so we get fully-functional window immediately. 720 // Set up delegate, so we get fully-functional window immediately.
722 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. 721 // It will not appear in UI though until |life_stage_ == kLoadCompleted|.
723 main_web_contents_->SetDelegate(this); 722 main_web_contents_->SetDelegate(this);
724 // Bindings take ownership over devtools as its delegate. 723 // Bindings take ownership over devtools as its delegate.
725 bindings_->SetDelegate(this); 724 bindings_->SetDelegate(this);
726 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a 725 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a
727 // ZoomController. 726 // ZoomController.
728 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_); 727 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_);
729 ui_zoom::ZoomController::FromWebContents(main_web_contents_) 728 ui_zoom::ZoomController::FromWebContents(main_web_contents_)
730 ->SetShowsNotificationBubble(false); 729 ->SetShowsNotificationBubble(false);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 if (life_stage_ != kLoadCompleted) { 1168 if (life_stage_ != kLoadCompleted) {
1170 // Load is completed when both kIsDockedSet and kOnLoadFired happened. 1169 // Load is completed when both kIsDockedSet and kOnLoadFired happened.
1171 // Here we set kOnLoadFired. 1170 // Here we set kOnLoadFired.
1172 life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired; 1171 life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired;
1173 } 1172 }
1174 if (life_stage_ == kLoadCompleted) 1173 if (life_stage_ == kLoadCompleted)
1175 LoadCompleted(); 1174 LoadCompleted();
1176 } 1175 }
1177 1176
1178 void DevToolsWindow::ReadyForTest() { 1177 void DevToolsWindow::ReadyForTest() {
1179 ready_for_test_ = true;
1180 if (!ready_for_test_callback_.is_null()) { 1178 if (!ready_for_test_callback_.is_null()) {
1181 ready_for_test_callback_.Run(); 1179 ready_for_test_callback_.Run();
1182 ready_for_test_callback_ = base::Closure(); 1180 ready_for_test_callback_ = base::Closure();
1183 } 1181 }
1184 } 1182 }
1185 1183
1186 void DevToolsWindow::CreateDevToolsBrowser() { 1184 void DevToolsWindow::CreateDevToolsBrowser() {
1187 PrefService* prefs = profile_->GetPrefs(); 1185 PrefService* prefs = profile_->GetPrefs();
1188 if (!prefs->GetDictionary(prefs::kAppWindowPlacement)->HasKey(kDevToolsApp)) { 1186 if (!prefs->GetDictionary(prefs::kAppWindowPlacement)->HasKey(kDevToolsApp)) {
1189 DictionaryPrefUpdate update(prefs, prefs::kAppWindowPlacement); 1187 DictionaryPrefUpdate update(prefs, prefs::kAppWindowPlacement);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { 1297 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) {
1300 // Only route reload via front-end if the agent is attached. 1298 // Only route reload via front-end if the agent is attached.
1301 WebContents* wc = GetInspectedWebContents(); 1299 WebContents* wc = GetInspectedWebContents();
1302 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1300 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1303 return false; 1301 return false;
1304 base::FundamentalValue ignore_cache_value(ignore_cache); 1302 base::FundamentalValue ignore_cache_value(ignore_cache);
1305 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1303 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1306 &ignore_cache_value, nullptr, nullptr); 1304 &ignore_cache_value, nullptr, nullptr);
1307 return true; 1305 return true;
1308 } 1306 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/devtools/devtools_window_testing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698