Chromium Code Reviews| 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/ui/panels/panel_host.h" | 5 #include "chrome/browser/ui/panels/panel_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 14 #include "chrome/browser/extensions/window_controller.h" | 14 #include "chrome/browser/extensions/window_controller.h" |
| 15 #include "chrome/browser/favicon/favicon_utils.h" | 15 #include "chrome/browser/favicon/favicon_utils.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/sessions/session_tab_helper.h" | 17 #include "chrome/browser/sessions/session_tab_helper.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 18 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/panels/panel.h" | 19 #include "chrome/browser/ui/panels/panel.h" |
| 20 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 20 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 21 #include "components/favicon/content/content_favicon_driver.h" | 21 #include "components/favicon/content/content_favicon_driver.h" |
| 22 #include "components/sessions/content/content_open_tab.h" | |
| 22 #include "components/ui/zoom/page_zoom.h" | 23 #include "components/ui/zoom/page_zoom.h" |
| 23 #include "components/ui/zoom/zoom_controller.h" | 24 #include "components/ui/zoom/zoom_controller.h" |
| 24 #include "content/public/browser/invalidate_type.h" | 25 #include "content/public/browser/invalidate_type.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
| 28 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
| 29 #include "content/public/browser/site_instance.h" | 30 #include "content/public/browser/site_instance.h" |
| 30 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
| 31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 59 // a ZoomController. | 60 // a ZoomController. |
| 60 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); | 61 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); |
| 61 content::WebContentsObserver::Observe(web_contents_.get()); | 62 content::WebContentsObserver::Observe(web_contents_.get()); |
| 62 | 63 |
| 63 // Needed to give the web contents a Tab ID. Extension APIs | 64 // Needed to give the web contents a Tab ID. Extension APIs |
| 64 // expect web contents to have a Tab ID. | 65 // expect web contents to have a Tab ID. |
| 65 SessionTabHelper::CreateForWebContents(web_contents_.get()); | 66 SessionTabHelper::CreateForWebContents(web_contents_.get()); |
| 66 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( | 67 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( |
| 67 panel_->session_id()); | 68 panel_->session_id()); |
| 68 | 69 |
| 70 sessions::ContentOpenTab::CreateForWebContents(web_contents_.get()); | |
|
sky
2015/09/16 20:04:53
It would be nice not to have to do this in a bunch
blundell
2015/09/16 20:19:42
AFAIK lazy initialization isn't done for WebConten
blundell
2015/09/17 11:52:25
Removed all the unnecessary callsites, leaving onl
| |
| 71 | |
| 69 favicon::CreateContentFaviconDriverForWebContents(web_contents_.get()); | 72 favicon::CreateContentFaviconDriverForWebContents(web_contents_.get()); |
| 70 PrefsTabHelper::CreateForWebContents(web_contents_.get()); | 73 PrefsTabHelper::CreateForWebContents(web_contents_.get()); |
| 71 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 74 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
| 72 web_contents_.get()); | 75 web_contents_.get()); |
| 73 extensions::ExtensionWebContentsObserver::GetForWebContents( | 76 extensions::ExtensionWebContentsObserver::GetForWebContents( |
| 74 web_contents_.get())->dispatcher()->set_delegate(this); | 77 web_contents_.get())->dispatcher()->set_delegate(this); |
| 75 | 78 |
| 76 web_contents_->GetController().LoadURL( | 79 web_contents_->GetController().LoadURL( |
| 77 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 80 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 78 } | 81 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 } | 242 } |
| 240 | 243 |
| 241 void PanelHost::StopLoading() { | 244 void PanelHost::StopLoading() { |
| 242 content::RecordAction(UserMetricsAction("Stop")); | 245 content::RecordAction(UserMetricsAction("Stop")); |
| 243 web_contents_->Stop(); | 246 web_contents_->Stop(); |
| 244 } | 247 } |
| 245 | 248 |
| 246 void PanelHost::Zoom(content::PageZoom zoom) { | 249 void PanelHost::Zoom(content::PageZoom zoom) { |
| 247 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); | 250 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); |
| 248 } | 251 } |
| OLD | NEW |