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

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

Issue 847703003: Refactor to move chrome_page_zoom functions to components/ui/zoom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac compile. Created 5 years, 11 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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/scoped_user_pref_update.h" 11 #include "base/prefs/scoped_user_pref_update.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chrome_page_zoom.h"
15 #include "chrome/browser/file_select_helper.h" 14 #include "chrome/browser/file_select_helper.h"
16 #include "chrome/browser/infobars/infobar_service.h" 15 #include "chrome/browser/infobars/infobar_service.h"
17 #include "chrome/browser/prefs/pref_service_syncable.h" 16 #include "chrome/browser/prefs/pref_service_syncable.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/sessions/session_tab_helper.h" 18 #include "chrome/browser/sessions/session_tab_helper.h"
20 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
22 #include "chrome/browser/ui/browser_iterator.h" 21 #include "chrome/browser/ui/browser_iterator.h"
23 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/host_desktop.h" 24 #include "chrome/browser/ui/host_desktop.h"
26 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 25 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/browser/ui/webui/devtools_ui.h" 27 #include "chrome/browser/ui/webui/devtools_ui.h"
29 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
31 #include "chrome/common/render_messages.h" 30 #include "chrome/common/render_messages.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "components/pref_registry/pref_registry_syncable.h" 32 #include "components/pref_registry/pref_registry_syncable.h"
33 #include "components/ui/zoom/page_zoom.h"
34 #include "components/ui/zoom/zoom_controller.h" 34 #include "components/ui/zoom/zoom_controller.h"
35 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/devtools_agent_host.h" 36 #include "content/public/browser/devtools_agent_host.h"
37 #include "content/public/browser/native_web_keyboard_event.h" 37 #include "content/public/browser/native_web_keyboard_event.h"
38 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
39 #include "content/public/browser/navigation_entry.h" 39 #include "content/public/browser/navigation_entry.h"
40 #include "content/public/browser/render_frame_host.h" 40 #include "content/public/browser/render_frame_host.h"
41 #include "content/public/browser/render_process_host.h" 41 #include "content/public/browser/render_process_host.h"
42 #include "content/public/browser/render_view_host.h" 42 #include "content/public/browser/render_view_host.h"
43 #include "content/public/browser/render_widget_host_view.h" 43 #include "content/public/browser/render_widget_host_view.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 684
685 main_web_contents_->GetController().LoadURL( 685 main_web_contents_->GetController().LoadURL(
686 DevToolsUIBindings::ApplyThemeToURL(profile, url), content::Referrer(), 686 DevToolsUIBindings::ApplyThemeToURL(profile, url), content::Referrer(),
687 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 687 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
688 688
689 bindings_ = DevToolsUIBindings::ForWebContents(main_web_contents_); 689 bindings_ = DevToolsUIBindings::ForWebContents(main_web_contents_);
690 DCHECK(bindings_); 690 DCHECK(bindings_);
691 691
692 // Bindings take ownership over devtools as its delegate. 692 // Bindings take ownership over devtools as its delegate.
693 bindings_->SetDelegate(this); 693 bindings_->SetDelegate(this);
694 // DevTools uses chrome_page_zoom::Zoom(), so main_web_contents_ requires a 694 // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a
695 // ZoomController. 695 // ZoomController.
696 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_); 696 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_);
697 ui_zoom::ZoomController::FromWebContents(main_web_contents_) 697 ui_zoom::ZoomController::FromWebContents(main_web_contents_)
698 ->SetShowsNotificationBubble(false); 698 ->SetShowsNotificationBubble(false);
699 699
700 g_instances.Get().push_back(this); 700 g_instances.Get().push_back(this);
701 701
702 // There is no inspected_web_contents in case of various workers. 702 // There is no inspected_web_contents in case of various workers.
703 if (inspected_web_contents) 703 if (inspected_web_contents)
704 inspected_contents_observer_.reset( 704 inspected_contents_observer_.reset(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 life_stage_ = kClosing; 874 life_stage_ = kClosing;
875 UpdateBrowserWindow(); 875 UpdateBrowserWindow();
876 // In case of docked main_web_contents_, we own it so delete here. 876 // In case of docked main_web_contents_, we own it so delete here.
877 // Embedding DevTools window will be deleted as a result of 877 // Embedding DevTools window will be deleted as a result of
878 // DevToolsUIBindings destruction. 878 // DevToolsUIBindings destruction.
879 delete main_web_contents_; 879 delete main_web_contents_;
880 } 880 }
881 881
882 void DevToolsWindow::ContentsZoomChange(bool zoom_in) { 882 void DevToolsWindow::ContentsZoomChange(bool zoom_in) {
883 DCHECK(is_docked_); 883 DCHECK(is_docked_);
884 chrome_page_zoom::Zoom(main_web_contents_, 884 ui_zoom::PageZoom::Zoom(main_web_contents_, zoom_in ? content::PAGE_ZOOM_IN
885 zoom_in ? content::PAGE_ZOOM_IN : content::PAGE_ZOOM_OUT); 885 : content::PAGE_ZOOM_OUT);
886 } 886 }
887 887
888 void DevToolsWindow::BeforeUnloadFired(WebContents* tab, 888 void DevToolsWindow::BeforeUnloadFired(WebContents* tab,
889 bool proceed, 889 bool proceed,
890 bool* proceed_to_fire_unload) { 890 bool* proceed_to_fire_unload) {
891 if (!intercepted_page_beforeunload_) { 891 if (!intercepted_page_beforeunload_) {
892 // Docked devtools window closed directly. 892 // Docked devtools window closed directly.
893 if (proceed) 893 if (proceed)
894 bindings_->Detach(); 894 bindings_->Detach();
895 *proceed_to_fire_unload = proceed; 895 *proceed_to_fire_unload = proceed;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 closure.Run(); 1224 closure.Run();
1225 return; 1225 return;
1226 } 1226 }
1227 load_completed_callback_ = closure; 1227 load_completed_callback_ = closure;
1228 } 1228 }
1229 1229
1230 bool DevToolsWindow::ForwardKeyboardEvent( 1230 bool DevToolsWindow::ForwardKeyboardEvent(
1231 const content::NativeWebKeyboardEvent& event) { 1231 const content::NativeWebKeyboardEvent& event) {
1232 return event_forwarder_->ForwardEvent(event); 1232 return event_forwarder_->ForwardEvent(event);
1233 } 1233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698