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

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

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 15 matching lines...) Expand all
26 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 26 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/webui/devtools_ui.h" 29 #include "chrome/browser/ui/webui/devtools_ui.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
33 #include "components/pref_registry/pref_registry_syncable.h" 33 #include "components/pref_registry/pref_registry_syncable.h"
34 #include "components/prefs/scoped_user_pref_update.h" 34 #include "components/prefs/scoped_user_pref_update.h"
35 #include "components/syncable_prefs/pref_service_syncable.h" 35 #include "components/syncable_prefs/pref_service_syncable.h"
36 #include "components/ui/zoom/page_zoom.h" 36 #include "components/zoom/page_zoom.h"
37 #include "components/ui/zoom/zoom_controller.h" 37 #include "components/zoom/zoom_controller.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/devtools_agent_host.h" 39 #include "content/public/browser/devtools_agent_host.h"
40 #include "content/public/browser/native_web_keyboard_event.h" 40 #include "content/public/browser/native_web_keyboard_event.h"
41 #include "content/public/browser/navigation_controller.h" 41 #include "content/public/browser/navigation_controller.h"
42 #include "content/public/browser/navigation_entry.h" 42 #include "content/public/browser/navigation_entry.h"
43 #include "content/public/browser/render_frame_host.h" 43 #include "content/public/browser/render_frame_host.h"
44 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_view_host.h" 45 #include "content/public/browser/render_view_host.h"
46 #include "content/public/browser/render_widget_host_view.h" 46 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/user_metrics.h" 47 #include "content/public/browser/user_metrics.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 720 ready_for_test_(false) {
721 // Set up delegate, so we get fully-functional window immediately. 721 // Set up delegate, so we get fully-functional window immediately.
722 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. 722 // It will not appear in UI though until |life_stage_ == kLoadCompleted|.
723 main_web_contents_->SetDelegate(this); 723 main_web_contents_->SetDelegate(this);
724 // Bindings take ownership over devtools as its delegate. 724 // Bindings take ownership over devtools as its delegate.
725 bindings_->SetDelegate(this); 725 bindings_->SetDelegate(this);
726 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a 726 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a
727 // ZoomController. 727 // ZoomController.
728 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_); 728 zoom::ZoomController::CreateForWebContents(main_web_contents_);
729 ui_zoom::ZoomController::FromWebContents(main_web_contents_) 729 zoom::ZoomController::FromWebContents(main_web_contents_)
730 ->SetShowsNotificationBubble(false); 730 ->SetShowsNotificationBubble(false);
731 731
732 g_instances.Get().push_back(this); 732 g_instances.Get().push_back(this);
733 733
734 // There is no inspected_web_contents in case of various workers. 734 // There is no inspected_web_contents in case of various workers.
735 if (inspected_web_contents) 735 if (inspected_web_contents)
736 inspected_contents_observer_.reset( 736 inspected_contents_observer_.reset(
737 new ObserverWithAccessor(inspected_web_contents)); 737 new ObserverWithAccessor(inspected_web_contents));
738 738
739 // Initialize docked page to be of the right size. 739 // Initialize docked page to be of the right size.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 life_stage_ = kClosing; 953 life_stage_ = kClosing;
954 UpdateBrowserWindow(); 954 UpdateBrowserWindow();
955 // In case of docked main_web_contents_, we own it so delete here. 955 // In case of docked main_web_contents_, we own it so delete here.
956 // Embedding DevTools window will be deleted as a result of 956 // Embedding DevTools window will be deleted as a result of
957 // DevToolsUIBindings destruction. 957 // DevToolsUIBindings destruction.
958 delete main_web_contents_; 958 delete main_web_contents_;
959 } 959 }
960 960
961 void DevToolsWindow::ContentsZoomChange(bool zoom_in) { 961 void DevToolsWindow::ContentsZoomChange(bool zoom_in) {
962 DCHECK(is_docked_); 962 DCHECK(is_docked_);
963 ui_zoom::PageZoom::Zoom(main_web_contents_, zoom_in ? content::PAGE_ZOOM_IN 963 zoom::PageZoom::Zoom(main_web_contents_, zoom_in ? content::PAGE_ZOOM_IN
964 : content::PAGE_ZOOM_OUT); 964 : content::PAGE_ZOOM_OUT);
965 } 965 }
966 966
967 void DevToolsWindow::BeforeUnloadFired(WebContents* tab, 967 void DevToolsWindow::BeforeUnloadFired(WebContents* tab,
968 bool proceed, 968 bool proceed,
969 bool* proceed_to_fire_unload) { 969 bool* proceed_to_fire_unload) {
970 if (!intercepted_page_beforeunload_) { 970 if (!intercepted_page_beforeunload_) {
971 // Docked devtools window closed directly. 971 // Docked devtools window closed directly.
972 if (proceed) 972 if (proceed)
973 bindings_->Detach(); 973 bindings_->Detach();
974 *proceed_to_fire_unload = proceed; 974 *proceed_to_fire_unload = proceed;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { 1299 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) {
1300 // Only route reload via front-end if the agent is attached. 1300 // Only route reload via front-end if the agent is attached.
1301 WebContents* wc = GetInspectedWebContents(); 1301 WebContents* wc = GetInspectedWebContents();
1302 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1302 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1303 return false; 1303 return false;
1304 base::FundamentalValue bypass_cache_value(bypass_cache); 1304 base::FundamentalValue bypass_cache_value(bypass_cache);
1305 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1305 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1306 &bypass_cache_value, nullptr, nullptr); 1306 &bypass_cache_value, nullptr, nullptr);
1307 return true; 1307 return true;
1308 } 1308 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.cc ('k') | chrome/browser/extensions/api/tabs/tabs_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698