| 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" | |
| 30 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/render_messages.h" | 31 #include "chrome/common/render_messages.h" |
| 33 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 34 #include "components/pref_registry/pref_registry_syncable.h" | 33 #include "components/pref_registry/pref_registry_syncable.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" |
| 44 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 chrome_page_zoom::Zoom(), so main_web_contents_ requires a |
| 695 // ZoomController. | 695 // ZoomController. |
| 696 ZoomController::CreateForWebContents(main_web_contents_); | 696 ui_zoom::ZoomController::CreateForWebContents(main_web_contents_); |
| 697 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( |
| 705 new ObserverWithAccessor(inspected_web_contents)); | 705 new ObserverWithAccessor(inspected_web_contents)); |
| 706 | 706 |
| 707 // Initialize docked page to be of the right size. | 707 // Initialize docked page to be of the right size. |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |