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

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

Issue 373733003: Make sure WebContents passed to chrome_page_zoom::Zoom() have a ZoomController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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" 14 #include "chrome/browser/chrome_page_zoom.h"
15 #include "chrome/browser/file_select_helper.h" 15 #include "chrome/browser/file_select_helper.h"
16 #include "chrome/browser/infobars/infobar_service.h" 16 #include "chrome/browser/infobars/infobar_service.h"
17 #include "chrome/browser/prefs/pref_service_syncable.h" 17 #include "chrome/browser/prefs/pref_service_syncable.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/sessions/session_tab_helper.h" 19 #include "chrome/browser/sessions/session_tab_helper.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_dialogs.h" 21 #include "chrome/browser/ui/browser_dialogs.h"
22 #include "chrome/browser/ui/browser_iterator.h" 22 #include "chrome/browser/ui/browser_iterator.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/host_desktop.h" 25 #include "chrome/browser/ui/host_desktop.h"
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/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/browser/ui/webui/devtools_ui.h" 28 #include "chrome/browser/ui/webui/devtools_ui.h"
29 #include "chrome/browser/ui/zoom/zoom_controller.h"
29 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/render_messages.h" 32 #include "chrome/common/render_messages.h"
32 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
33 #include "components/pref_registry/pref_registry_syncable.h" 34 #include "components/pref_registry/pref_registry_syncable.h"
34 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/devtools_agent_host.h" 36 #include "content/public/browser/devtools_agent_host.h"
36 #include "content/public/browser/devtools_client_host.h" 37 #include "content/public/browser/devtools_client_host.h"
37 #include "content/public/browser/devtools_manager.h" 38 #include "content/public/browser/devtools_manager.h"
38 #include "content/public/browser/native_web_keyboard_event.h" 39 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ignore_set_is_docked_(false), 708 ignore_set_is_docked_(false),
708 intercepted_page_beforeunload_(false) { 709 intercepted_page_beforeunload_(false) {
709 // Set up delegate, so we get fully-functional window immediately. 710 // Set up delegate, so we get fully-functional window immediately.
710 // It will not appear in UI though until |load_state_ == kLoadCompleted|. 711 // It will not appear in UI though until |load_state_ == kLoadCompleted|.
711 main_web_contents_->SetDelegate(this); 712 main_web_contents_->SetDelegate(this);
712 bindings_ = new DevToolsUIBindings( 713 bindings_ = new DevToolsUIBindings(
713 main_web_contents_, 714 main_web_contents_,
714 DevToolsUIBindings::ApplyThemeToURL(profile, url)); 715 DevToolsUIBindings::ApplyThemeToURL(profile, url));
715 // Bindings take ownership over devtools as its delegate. 716 // Bindings take ownership over devtools as its delegate.
716 bindings_->SetDelegate(this); 717 bindings_->SetDelegate(this);
718 // DevTools uses chrome_page_zoom::Zoom(), so main_web_contents_ requires a
719 // ZoomController.
720 ZoomController::CreateForWebContents(main_web_contents_);
717 721
718 g_instances.Get().push_back(this); 722 g_instances.Get().push_back(this);
719 723
720 // There is no inspected_rvh in case of shared workers. 724 // There is no inspected_rvh in case of shared workers.
721 if (inspected_rvh) 725 if (inspected_rvh)
722 inspected_contents_observer_.reset(new ObserverWithAccessor( 726 inspected_contents_observer_.reset(new ObserverWithAccessor(
723 content::WebContents::FromRenderViewHost(inspected_rvh))); 727 content::WebContents::FromRenderViewHost(inspected_rvh)));
724 event_forwarder_.reset(new DevToolsEventForwarder(this)); 728 event_forwarder_.reset(new DevToolsEventForwarder(this));
725 } 729 }
726 730
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 closure.Run(); 1274 closure.Run();
1271 return; 1275 return;
1272 } 1276 }
1273 load_completed_callback_ = closure; 1277 load_completed_callback_ = closure;
1274 } 1278 }
1275 1279
1276 bool DevToolsWindow::ForwardKeyboardEvent( 1280 bool DevToolsWindow::ForwardKeyboardEvent(
1277 const content::NativeWebKeyboardEvent& event) { 1281 const content::NativeWebKeyboardEvent& event) {
1278 return event_forwarder_->ForwardEvent(event); 1282 return event_forwarder_->ForwardEvent(event);
1279 } 1283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698