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" |
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 ignore_set_is_docked_(false), | 701 ignore_set_is_docked_(false), |
701 intercepted_page_beforeunload_(false) { | 702 intercepted_page_beforeunload_(false) { |
702 // Set up delegate, so we get fully-functional window immediately. | 703 // Set up delegate, so we get fully-functional window immediately. |
703 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. | 704 // It will not appear in UI though until |life_stage_ == kLoadCompleted|. |
704 main_web_contents_->SetDelegate(this); | 705 main_web_contents_->SetDelegate(this); |
705 bindings_ = new DevToolsUIBindings( | 706 bindings_ = new DevToolsUIBindings( |
706 main_web_contents_, | 707 main_web_contents_, |
707 DevToolsUIBindings::ApplyThemeToURL(profile, url)); | 708 DevToolsUIBindings::ApplyThemeToURL(profile, url)); |
708 // Bindings take ownership over devtools as its delegate. | 709 // Bindings take ownership over devtools as its delegate. |
709 bindings_->SetDelegate(this); | 710 bindings_->SetDelegate(this); |
| 711 // DevTools uses chrome_page_zoom::Zoom(), so main_web_contents_ requires a |
| 712 // ZoomController. |
| 713 ZoomController::CreateForWebContents(main_web_contents_); |
| 714 ZoomController::FromWebContents(main_web_contents_) |
| 715 ->SetShowsNotificationBubble(false); |
710 | 716 |
711 g_instances.Get().push_back(this); | 717 g_instances.Get().push_back(this); |
712 | 718 |
713 // There is no inspected_rvh in case of shared workers. | 719 // There is no inspected_rvh in case of shared workers. |
714 if (inspected_rvh) | 720 if (inspected_rvh) |
715 inspected_contents_observer_.reset(new ObserverWithAccessor( | 721 inspected_contents_observer_.reset(new ObserverWithAccessor( |
716 content::WebContents::FromRenderViewHost(inspected_rvh))); | 722 content::WebContents::FromRenderViewHost(inspected_rvh))); |
717 event_forwarder_.reset(new DevToolsEventForwarder(this)); | 723 event_forwarder_.reset(new DevToolsEventForwarder(this)); |
718 } | 724 } |
719 | 725 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 closure.Run(); | 1264 closure.Run(); |
1259 return; | 1265 return; |
1260 } | 1266 } |
1261 load_completed_callback_ = closure; | 1267 load_completed_callback_ = closure; |
1262 } | 1268 } |
1263 | 1269 |
1264 bool DevToolsWindow::ForwardKeyboardEvent( | 1270 bool DevToolsWindow::ForwardKeyboardEvent( |
1265 const content::NativeWebKeyboardEvent& event) { | 1271 const content::NativeWebKeyboardEvent& event) { |
1266 return event_forwarder_->ForwardEvent(event); | 1272 return event_forwarder_->ForwardEvent(event); |
1267 } | 1273 } |
OLD | NEW |