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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 prefs::kDevToolsPortForwardingConfig, | 356 prefs::kDevToolsPortForwardingConfig, |
357 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 357 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
358 } | 358 } |
359 | 359 |
360 // static | 360 // static |
361 content::WebContents* DevToolsWindow::GetInTabWebContents( | 361 content::WebContents* DevToolsWindow::GetInTabWebContents( |
362 WebContents* inspected_web_contents, | 362 WebContents* inspected_web_contents, |
363 DevToolsContentsResizingStrategy* out_strategy) { | 363 DevToolsContentsResizingStrategy* out_strategy) { |
364 DevToolsWindow* window = GetInstanceForInspectedWebContents( | 364 DevToolsWindow* window = GetInstanceForInspectedWebContents( |
365 inspected_web_contents); | 365 inspected_web_contents); |
366 if (!window) | 366 if (!window || window->life_stage_ == kClosing) |
367 return NULL; | 367 return NULL; |
368 | 368 |
369 // Not yet loaded window is treated as docked, but we should not present it | 369 // Not yet loaded window is treated as docked, but we should not present it |
370 // until we decided on docking. | 370 // until we decided on docking. |
371 bool is_docked_set = window->load_state_ == kLoadCompleted || | 371 bool is_docked_set = window->life_stage_ == kLoadCompleted || |
372 window->load_state_ == kIsDockedSet; | 372 window->life_stage_ == kIsDockedSet; |
373 if (!is_docked_set) | 373 if (!is_docked_set) |
374 return NULL; | 374 return NULL; |
375 | 375 |
376 // Undocked window should have toolbox web contents. | 376 // Undocked window should have toolbox web contents. |
377 if (!window->is_docked_ && !window->toolbox_web_contents_) | 377 if (!window->is_docked_ && !window->toolbox_web_contents_) |
378 return NULL; | 378 return NULL; |
379 | 379 |
380 if (out_strategy) | 380 if (out_strategy) |
381 out_strategy->CopyFrom(window->contents_resizing_strategy_); | 381 out_strategy->CopyFrom(window->contents_resizing_strategy_); |
382 | 382 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; | 532 bool should_measure_time = FindDevToolsWindow(agent.get()) == NULL; |
533 base::TimeTicks start_time = base::TimeTicks::Now(); | 533 base::TimeTicks start_time = base::TimeTicks::Now(); |
534 // TODO(loislo): we should initiate DevTools window opening from within | 534 // TODO(loislo): we should initiate DevTools window opening from within |
535 // renderer. Otherwise, we still can hit a race condition here. | 535 // renderer. Otherwise, we still can hit a race condition here. |
536 DevToolsWindow* window = OpenDevToolsWindow(inspected_rvh); | 536 DevToolsWindow* window = OpenDevToolsWindow(inspected_rvh); |
537 if (should_measure_time) | 537 if (should_measure_time) |
538 window->inspect_element_start_time_ = start_time; | 538 window->inspect_element_start_time_ = start_time; |
539 } | 539 } |
540 | 540 |
541 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { | 541 void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) { |
542 if (load_state_ == kLoadCompleted) { | 542 if (life_stage_ == kLoadCompleted) { |
543 Show(action); | 543 Show(action); |
544 return; | 544 return; |
545 } | 545 } |
546 | 546 |
547 // Action will be done only after load completed. | 547 // Action will be done only after load completed. |
548 action_on_load_ = action; | 548 action_on_load_ = action; |
549 | 549 |
550 if (!can_dock_) { | 550 if (!can_dock_) { |
551 // No harm to show always-undocked window right away. | 551 // No harm to show always-undocked window right away. |
552 is_docked_ = false; | 552 is_docked_ = false; |
553 Show(DevToolsToggleAction::Show()); | 553 Show(DevToolsToggleAction::Show()); |
554 } | 554 } |
555 } | 555 } |
556 | 556 |
557 void DevToolsWindow::Show(const DevToolsToggleAction& action) { | 557 void DevToolsWindow::Show(const DevToolsToggleAction& action) { |
| 558 if (life_stage_ == kClosing) |
| 559 return; |
| 560 |
558 if (action.type() == DevToolsToggleAction::kNoOp) | 561 if (action.type() == DevToolsToggleAction::kNoOp) |
559 return; | 562 return; |
560 | 563 |
561 if (is_docked_) { | 564 if (is_docked_) { |
562 DCHECK(can_dock_); | 565 DCHECK(can_dock_); |
563 Browser* inspected_browser = NULL; | 566 Browser* inspected_browser = NULL; |
564 int inspected_tab_index = -1; | 567 int inspected_tab_index = -1; |
565 FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), | 568 FindInspectedBrowserAndTabIndex(GetInspectedWebContents(), |
566 &inspected_browser, | 569 &inspected_browser, |
567 &inspected_tab_index); | 570 &inspected_tab_index); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 625 } |
623 | 626 |
624 // static | 627 // static |
625 bool DevToolsWindow::InterceptPageBeforeUnload(WebContents* contents) { | 628 bool DevToolsWindow::InterceptPageBeforeUnload(WebContents* contents) { |
626 DevToolsWindow* window = | 629 DevToolsWindow* window = |
627 DevToolsWindow::GetInstanceForInspectedWebContents(contents); | 630 DevToolsWindow::GetInstanceForInspectedWebContents(contents); |
628 if (!window || window->intercepted_page_beforeunload_) | 631 if (!window || window->intercepted_page_beforeunload_) |
629 return false; | 632 return false; |
630 | 633 |
631 // Not yet loaded frontend will not handle beforeunload. | 634 // Not yet loaded frontend will not handle beforeunload. |
632 if (window->load_state_ != kLoadCompleted) | 635 if (window->life_stage_ != kLoadCompleted) |
633 return false; | 636 return false; |
634 | 637 |
635 window->intercepted_page_beforeunload_ = true; | 638 window->intercepted_page_beforeunload_ = true; |
636 // Handle case of devtools inspecting another devtools instance by passing | 639 // Handle case of devtools inspecting another devtools instance by passing |
637 // the call up to the inspecting devtools instance. | 640 // the call up to the inspecting devtools instance. |
638 if (!DevToolsWindow::InterceptPageBeforeUnload(window->main_web_contents_)) { | 641 if (!DevToolsWindow::InterceptPageBeforeUnload(window->main_web_contents_)) { |
639 window->main_web_contents_->DispatchBeforeUnload(false); | 642 window->main_web_contents_->DispatchBeforeUnload(false); |
640 } | 643 } |
641 return true; | 644 return true; |
642 } | 645 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 main_web_contents_( | 688 main_web_contents_( |
686 WebContents::Create(WebContents::CreateParams(profile))), | 689 WebContents::Create(WebContents::CreateParams(profile))), |
687 toolbox_web_contents_(NULL), | 690 toolbox_web_contents_(NULL), |
688 bindings_(NULL), | 691 bindings_(NULL), |
689 browser_(NULL), | 692 browser_(NULL), |
690 is_docked_(true), | 693 is_docked_(true), |
691 can_dock_(can_dock), | 694 can_dock_(can_dock), |
692 // This initialization allows external front-end to work without changes. | 695 // This initialization allows external front-end to work without changes. |
693 // We don't wait for docking call, but instead immediately show undocked. | 696 // We don't wait for docking call, but instead immediately show undocked. |
694 // Passing "dockSide=undocked" parameter ensures proper UI. | 697 // Passing "dockSide=undocked" parameter ensures proper UI. |
695 load_state_(can_dock ? kNotLoaded : kIsDockedSet), | 698 life_stage_(can_dock ? kNotLoaded : kIsDockedSet), |
696 action_on_load_(DevToolsToggleAction::NoOp()), | 699 action_on_load_(DevToolsToggleAction::NoOp()), |
697 ignore_set_is_docked_(false), | 700 ignore_set_is_docked_(false), |
698 intercepted_page_beforeunload_(false) { | 701 intercepted_page_beforeunload_(false) { |
699 // Set up delegate, so we get fully-functional window immediately. | 702 // Set up delegate, so we get fully-functional window immediately. |
700 // It will not appear in UI though until |load_state_ == kLoadCompleted|. | 703 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. |
701 main_web_contents_->SetDelegate(this); | 704 main_web_contents_->SetDelegate(this); |
702 bindings_ = new DevToolsUIBindings( | 705 bindings_ = new DevToolsUIBindings( |
703 main_web_contents_, | 706 main_web_contents_, |
704 DevToolsUIBindings::ApplyThemeToURL(profile, url)); | 707 DevToolsUIBindings::ApplyThemeToURL(profile, url)); |
705 // Bindings take ownership over devtools as its delegate. | 708 // Bindings take ownership over devtools as its delegate. |
706 bindings_->SetDelegate(this); | 709 bindings_->SetDelegate(this); |
707 | 710 |
708 g_instances.Get().push_back(this); | 711 g_instances.Get().push_back(this); |
709 | 712 |
710 // There is no inspected_rvh in case of shared workers. | 713 // There is no inspected_rvh in case of shared workers. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 WebContents* new_contents) { | 867 WebContents* new_contents) { |
865 if (target_url.SchemeIs(content::kChromeDevToolsScheme) && | 868 if (target_url.SchemeIs(content::kChromeDevToolsScheme) && |
866 target_url.query().find("toolbox=true") != std::string::npos) { | 869 target_url.query().find("toolbox=true") != std::string::npos) { |
867 CHECK(can_dock_); | 870 CHECK(can_dock_); |
868 toolbox_web_contents_ = new_contents; | 871 toolbox_web_contents_ = new_contents; |
869 } | 872 } |
870 } | 873 } |
871 | 874 |
872 void DevToolsWindow::CloseContents(WebContents* source) { | 875 void DevToolsWindow::CloseContents(WebContents* source) { |
873 CHECK(is_docked_); | 876 CHECK(is_docked_); |
874 // Do this first so that when GetDockedInstanceForInspectedTab is called | 877 life_stage_ = kClosing; |
875 // from UpdateDevTools it won't return this instance | |
876 // see crbug.com/372504 | |
877 content::DevToolsManager::GetInstance()->ClientHostClosing( | |
878 bindings_->frontend_host()); | |
879 // This will prevent any activity after frontend is loaded. | |
880 action_on_load_ = DevToolsToggleAction::NoOp(); | |
881 ignore_set_is_docked_ = true; | |
882 UpdateBrowserWindow(); | 878 UpdateBrowserWindow(); |
883 // In case of docked main_web_contents_, we own it so delete here. | 879 // In case of docked main_web_contents_, we own it so delete here. |
884 // Embedding DevTools window will be deleted as a result of | 880 // Embedding DevTools window will be deleted as a result of |
885 // DevToolsUIBindings destruction. | 881 // DevToolsUIBindings destruction. |
886 delete main_web_contents_; | 882 delete main_web_contents_; |
887 } | 883 } |
888 | 884 |
889 void DevToolsWindow::ContentsZoomChange(bool zoom_in) { | 885 void DevToolsWindow::ContentsZoomChange(bool zoom_in) { |
890 DCHECK(is_docked_); | 886 DCHECK(is_docked_); |
891 chrome_page_zoom::Zoom(main_web_contents_, | 887 chrome_page_zoom::Zoom(main_web_contents_, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 976 |
981 void DevToolsWindow::ActivateWindow() { | 977 void DevToolsWindow::ActivateWindow() { |
982 if (is_docked_ && GetInspectedBrowserWindow()) | 978 if (is_docked_ && GetInspectedBrowserWindow()) |
983 main_web_contents_->Focus(); | 979 main_web_contents_->Focus(); |
984 else if (!is_docked_ && !browser_->window()->IsActive()) | 980 else if (!is_docked_ && !browser_->window()->IsActive()) |
985 browser_->window()->Activate(); | 981 browser_->window()->Activate(); |
986 } | 982 } |
987 | 983 |
988 void DevToolsWindow::CloseWindow() { | 984 void DevToolsWindow::CloseWindow() { |
989 DCHECK(is_docked_); | 985 DCHECK(is_docked_); |
990 // This will prevent any activity after frontend is loaded. | 986 life_stage_ = kClosing; |
991 action_on_load_ = DevToolsToggleAction::NoOp(); | |
992 ignore_set_is_docked_ = true; | |
993 main_web_contents_->DispatchBeforeUnload(false); | 987 main_web_contents_->DispatchBeforeUnload(false); |
994 } | 988 } |
995 | 989 |
996 void DevToolsWindow::SetInspectedPageBounds(const gfx::Rect& rect) { | 990 void DevToolsWindow::SetInspectedPageBounds(const gfx::Rect& rect) { |
997 DevToolsContentsResizingStrategy strategy(rect); | 991 DevToolsContentsResizingStrategy strategy(rect); |
998 if (contents_resizing_strategy_.Equals(strategy)) | 992 if (contents_resizing_strategy_.Equals(strategy)) |
999 return; | 993 return; |
1000 | 994 |
1001 contents_resizing_strategy_.CopyFrom(strategy); | 995 contents_resizing_strategy_.CopyFrom(strategy); |
1002 UpdateBrowserWindow(); | 996 UpdateBrowserWindow(); |
(...skipping 20 matching lines...) Expand all Loading... |
1023 void DevToolsWindow::MoveWindow(int x, int y) { | 1017 void DevToolsWindow::MoveWindow(int x, int y) { |
1024 if (!is_docked_) { | 1018 if (!is_docked_) { |
1025 gfx::Rect bounds = browser_->window()->GetBounds(); | 1019 gfx::Rect bounds = browser_->window()->GetBounds(); |
1026 bounds.Offset(x, y); | 1020 bounds.Offset(x, y); |
1027 browser_->window()->SetBounds(bounds); | 1021 browser_->window()->SetBounds(bounds); |
1028 } | 1022 } |
1029 } | 1023 } |
1030 | 1024 |
1031 void DevToolsWindow::SetIsDockedAndShowImmediatelyForTest(bool is_docked) { | 1025 void DevToolsWindow::SetIsDockedAndShowImmediatelyForTest(bool is_docked) { |
1032 DCHECK(!is_docked || can_dock_); | 1026 DCHECK(!is_docked || can_dock_); |
1033 if (load_state_ == kLoadCompleted) { | 1027 DCHECK(life_stage_ != kClosing); |
| 1028 if (life_stage_ == kLoadCompleted) { |
1034 SetIsDocked(is_docked); | 1029 SetIsDocked(is_docked); |
1035 } else { | 1030 } else { |
1036 is_docked_ = is_docked; | 1031 is_docked_ = is_docked; |
1037 // Load is completed when both kIsDockedSet and kOnLoadFired happened. | 1032 // Load is completed when both kIsDockedSet and kOnLoadFired happened. |
1038 // Note that kIsDockedSet may be already set when can_dock_ is false. | 1033 // Note that kIsDockedSet may be already set when can_dock_ is false. |
1039 load_state_ = load_state_ == kOnLoadFired ? kLoadCompleted : kIsDockedSet; | 1034 life_stage_ = life_stage_ == kOnLoadFired ? kLoadCompleted : kIsDockedSet; |
1040 // Note that action_on_load_ will be performed after the load is actually | 1035 // Note that action_on_load_ will be performed after the load is actually |
1041 // completed. For now, just show the window. | 1036 // completed. For now, just show the window. |
1042 Show(DevToolsToggleAction::Show()); | 1037 Show(DevToolsToggleAction::Show()); |
1043 if (load_state_ == kLoadCompleted) | 1038 if (life_stage_ == kLoadCompleted) |
1044 LoadCompleted(); | 1039 LoadCompleted(); |
1045 } | 1040 } |
1046 ignore_set_is_docked_ = true; | 1041 ignore_set_is_docked_ = true; |
1047 } | 1042 } |
1048 | 1043 |
1049 void DevToolsWindow::SetIsDocked(bool dock_requested) { | 1044 void DevToolsWindow::SetIsDocked(bool dock_requested) { |
1050 if (ignore_set_is_docked_) | 1045 if (ignore_set_is_docked_ || life_stage_ == kClosing) |
1051 return; | 1046 return; |
1052 | 1047 |
1053 DCHECK(can_dock_ || !dock_requested); | 1048 DCHECK(can_dock_ || !dock_requested); |
1054 if (!can_dock_) | 1049 if (!can_dock_) |
1055 dock_requested = false; | 1050 dock_requested = false; |
1056 | 1051 |
1057 bool was_docked = is_docked_; | 1052 bool was_docked = is_docked_; |
1058 is_docked_ = dock_requested; | 1053 is_docked_ = dock_requested; |
1059 | 1054 |
1060 if (load_state_ != kLoadCompleted) { | 1055 if (life_stage_ != kLoadCompleted) { |
1061 // This is a first time call we waited for to initialize. | 1056 // This is a first time call we waited for to initialize. |
1062 load_state_ = load_state_ == kOnLoadFired ? kLoadCompleted : kIsDockedSet; | 1057 life_stage_ = life_stage_ == kOnLoadFired ? kLoadCompleted : kIsDockedSet; |
1063 if (load_state_ == kLoadCompleted) | 1058 if (life_stage_ == kLoadCompleted) |
1064 LoadCompleted(); | 1059 LoadCompleted(); |
1065 return; | 1060 return; |
1066 } | 1061 } |
1067 | 1062 |
1068 if (dock_requested == was_docked) | 1063 if (dock_requested == was_docked) |
1069 return; | 1064 return; |
1070 | 1065 |
1071 if (dock_requested && !was_docked) { | 1066 if (dock_requested && !was_docked) { |
1072 // Detach window from the external devtools browser. It will lead to | 1067 // Detach window from the external devtools browser. It will lead to |
1073 // the browser object's close and delete. Remove observer first. | 1068 // the browser object's close and delete. Remove observer first. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 } | 1107 } |
1113 } | 1108 } |
1114 | 1109 |
1115 void DevToolsWindow::SetWhitelistedShortcuts( | 1110 void DevToolsWindow::SetWhitelistedShortcuts( |
1116 const std::string& message) { | 1111 const std::string& message) { |
1117 event_forwarder_->SetWhitelistedShortcuts(message); | 1112 event_forwarder_->SetWhitelistedShortcuts(message); |
1118 } | 1113 } |
1119 | 1114 |
1120 void DevToolsWindow::InspectedContentsClosing() { | 1115 void DevToolsWindow::InspectedContentsClosing() { |
1121 intercepted_page_beforeunload_ = false; | 1116 intercepted_page_beforeunload_ = false; |
1122 // This will prevent any activity after frontend is loaded. | 1117 life_stage_ = kClosing; |
1123 action_on_load_ = DevToolsToggleAction::NoOp(); | |
1124 ignore_set_is_docked_ = true; | |
1125 main_web_contents_->GetRenderViewHost()->ClosePage(); | 1118 main_web_contents_->GetRenderViewHost()->ClosePage(); |
1126 } | 1119 } |
1127 | 1120 |
1128 InfoBarService* DevToolsWindow::GetInfoBarService() { | 1121 InfoBarService* DevToolsWindow::GetInfoBarService() { |
1129 return is_docked_ ? | 1122 return is_docked_ ? |
1130 InfoBarService::FromWebContents(GetInspectedWebContents()) : | 1123 InfoBarService::FromWebContents(GetInspectedWebContents()) : |
1131 InfoBarService::FromWebContents(main_web_contents_); | 1124 InfoBarService::FromWebContents(main_web_contents_); |
1132 } | 1125 } |
1133 | 1126 |
1134 void DevToolsWindow::RenderProcessGone() { | 1127 void DevToolsWindow::RenderProcessGone() { |
(...skipping 10 matching lines...) Expand all Loading... |
1145 if (inspected_web_contents) { | 1138 if (inspected_web_contents) { |
1146 SessionTabHelper* session_tab_helper = | 1139 SessionTabHelper* session_tab_helper = |
1147 SessionTabHelper::FromWebContents(inspected_web_contents); | 1140 SessionTabHelper::FromWebContents(inspected_web_contents); |
1148 if (session_tab_helper) { | 1141 if (session_tab_helper) { |
1149 base::FundamentalValue tabId(session_tab_helper->session_id().id()); | 1142 base::FundamentalValue tabId(session_tab_helper->session_id().id()); |
1150 bindings_->CallClientFunction("WebInspector.setInspectedTabId", | 1143 bindings_->CallClientFunction("WebInspector.setInspectedTabId", |
1151 &tabId, NULL, NULL); | 1144 &tabId, NULL, NULL); |
1152 } | 1145 } |
1153 } | 1146 } |
1154 | 1147 |
| 1148 if (life_stage_ == kClosing) |
| 1149 return; |
| 1150 |
1155 // We could be in kLoadCompleted state already if frontend reloads itself. | 1151 // We could be in kLoadCompleted state already if frontend reloads itself. |
1156 if (load_state_ != kLoadCompleted) { | 1152 if (life_stage_ != kLoadCompleted) { |
1157 // Load is completed when both kIsDockedSet and kOnLoadFired happened. | 1153 // Load is completed when both kIsDockedSet and kOnLoadFired happened. |
1158 // Here we set kOnLoadFired. | 1154 // Here we set kOnLoadFired. |
1159 load_state_ = load_state_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired; | 1155 life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired; |
1160 } | 1156 } |
1161 if (load_state_ == kLoadCompleted) | 1157 if (life_stage_ == kLoadCompleted) |
1162 LoadCompleted(); | 1158 LoadCompleted(); |
1163 } | 1159 } |
1164 | 1160 |
1165 void DevToolsWindow::CreateDevToolsBrowser() { | 1161 void DevToolsWindow::CreateDevToolsBrowser() { |
1166 std::string wp_key = GetDevToolsWindowPlacementPrefKey(); | 1162 std::string wp_key = GetDevToolsWindowPlacementPrefKey(); |
1167 PrefService* prefs = profile_->GetPrefs(); | 1163 PrefService* prefs = profile_->GetPrefs(); |
1168 const base::DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); | 1164 const base::DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); |
1169 if (!wp_pref || wp_pref->empty()) { | 1165 if (!wp_pref || wp_pref->empty()) { |
1170 DictionaryPrefUpdate update(prefs, wp_key.c_str()); | 1166 DictionaryPrefUpdate update(prefs, wp_key.c_str()); |
1171 base::DictionaryValue* defaults = update.Get(); | 1167 base::DictionaryValue* defaults = update.Get(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 void DevToolsWindow::LoadCompleted() { | 1246 void DevToolsWindow::LoadCompleted() { |
1251 Show(action_on_load_); | 1247 Show(action_on_load_); |
1252 action_on_load_ = DevToolsToggleAction::NoOp(); | 1248 action_on_load_ = DevToolsToggleAction::NoOp(); |
1253 if (!load_completed_callback_.is_null()) { | 1249 if (!load_completed_callback_.is_null()) { |
1254 load_completed_callback_.Run(); | 1250 load_completed_callback_.Run(); |
1255 load_completed_callback_ = base::Closure(); | 1251 load_completed_callback_ = base::Closure(); |
1256 } | 1252 } |
1257 } | 1253 } |
1258 | 1254 |
1259 void DevToolsWindow::SetLoadCompletedCallback(const base::Closure& closure) { | 1255 void DevToolsWindow::SetLoadCompletedCallback(const base::Closure& closure) { |
1260 if (load_state_ == kLoadCompleted) { | 1256 if (life_stage_ == kLoadCompleted) { |
1261 if (!closure.is_null()) | 1257 if (!closure.is_null()) |
1262 closure.Run(); | 1258 closure.Run(); |
1263 return; | 1259 return; |
1264 } | 1260 } |
1265 load_completed_callback_ = closure; | 1261 load_completed_callback_ = closure; |
1266 } | 1262 } |
1267 | 1263 |
1268 bool DevToolsWindow::ForwardKeyboardEvent( | 1264 bool DevToolsWindow::ForwardKeyboardEvent( |
1269 const content::NativeWebKeyboardEvent& event) { | 1265 const content::NativeWebKeyboardEvent& event) { |
1270 return event_forwarder_->ForwardEvent(event); | 1266 return event_forwarder_->ForwardEvent(event); |
1271 } | 1267 } |
OLD | NEW |