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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 15 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
16 #include "chrome/browser/extensions/window_controller.h" | 16 #include "chrome/browser/extensions/window_controller.h" |
17 #include "chrome/browser/favicon/favicon_utils.h" | 17 #include "chrome/browser/favicon/favicon_utils.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_navigator.h" | 20 #include "chrome/browser/ui/browser_navigator.h" |
21 #include "chrome/browser/ui/browser_navigator_params.h" | 21 #include "chrome/browser/ui/browser_navigator_params.h" |
22 #include "chrome/browser/ui/panels/panel.h" | 22 #include "chrome/browser/ui/panels/panel.h" |
23 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 23 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
24 #include "components/favicon/content/content_favicon_driver.h" | 24 #include "components/favicon/content/content_favicon_driver.h" |
25 #include "components/ui/zoom/page_zoom.h" | 25 #include "components/zoom/page_zoom.h" |
26 #include "components/ui/zoom/zoom_controller.h" | 26 #include "components/zoom/zoom_controller.h" |
27 #include "content/public/browser/invalidate_type.h" | 27 #include "content/public/browser/invalidate_type.h" |
28 #include "content/public/browser/navigation_controller.h" | 28 #include "content/public/browser/navigation_controller.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
31 #include "content/public/browser/notification_types.h" | 31 #include "content/public/browser/notification_types.h" |
32 #include "content/public/browser/site_instance.h" | 32 #include "content/public/browser/site_instance.h" |
33 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "extensions/browser/view_type_utils.h" | 35 #include "extensions/browser/view_type_utils.h" |
36 #include "ipc/ipc_message.h" | 36 #include "ipc/ipc_message.h" |
(...skipping 20 matching lines...) Expand all Loading... |
57 scoped_refptr<content::SiteInstance> instance = | 57 scoped_refptr<content::SiteInstance> instance = |
58 source_site_instance ? source_site_instance->GetRelatedSiteInstance(url) | 58 source_site_instance ? source_site_instance->GetRelatedSiteInstance(url) |
59 : content::SiteInstance::CreateForURL(profile_, url); | 59 : content::SiteInstance::CreateForURL(profile_, url); |
60 content::WebContents::CreateParams create_params(profile_, | 60 content::WebContents::CreateParams create_params(profile_, |
61 std::move(instance)); | 61 std::move(instance)); |
62 web_contents_.reset(content::WebContents::Create(create_params)); | 62 web_contents_.reset(content::WebContents::Create(create_params)); |
63 extensions::SetViewType(web_contents_.get(), extensions::VIEW_TYPE_PANEL); | 63 extensions::SetViewType(web_contents_.get(), extensions::VIEW_TYPE_PANEL); |
64 web_contents_->SetDelegate(this); | 64 web_contents_->SetDelegate(this); |
65 // web_contents_ may be passed to PageZoom::Zoom(), so it needs | 65 // web_contents_ may be passed to PageZoom::Zoom(), so it needs |
66 // a ZoomController. | 66 // a ZoomController. |
67 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); | 67 zoom::ZoomController::CreateForWebContents(web_contents_.get()); |
68 content::WebContentsObserver::Observe(web_contents_.get()); | 68 content::WebContentsObserver::Observe(web_contents_.get()); |
69 | 69 |
70 // Needed to give the web contents a Tab ID. Extension APIs | 70 // Needed to give the web contents a Tab ID. Extension APIs |
71 // expect web contents to have a Tab ID. | 71 // expect web contents to have a Tab ID. |
72 SessionTabHelper::CreateForWebContents(web_contents_.get()); | 72 SessionTabHelper::CreateForWebContents(web_contents_.get()); |
73 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( | 73 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( |
74 panel_->session_id()); | 74 panel_->session_id()); |
75 | 75 |
76 favicon::CreateContentFaviconDriverForWebContents(web_contents_.get()); | 76 favicon::CreateContentFaviconDriverForWebContents(web_contents_.get()); |
77 PrefsTabHelper::CreateForWebContents(web_contents_.get()); | 77 PrefsTabHelper::CreateForWebContents(web_contents_.get()); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 content::RecordAction(UserMetricsAction("ReloadBypassingCache")); | 242 content::RecordAction(UserMetricsAction("ReloadBypassingCache")); |
243 web_contents_->GetController().ReloadBypassingCache(true); | 243 web_contents_->GetController().ReloadBypassingCache(true); |
244 } | 244 } |
245 | 245 |
246 void PanelHost::StopLoading() { | 246 void PanelHost::StopLoading() { |
247 content::RecordAction(UserMetricsAction("Stop")); | 247 content::RecordAction(UserMetricsAction("Stop")); |
248 web_contents_->Stop(); | 248 web_contents_->Stop(); |
249 } | 249 } |
250 | 250 |
251 void PanelHost::Zoom(content::PageZoom zoom) { | 251 void PanelHost::Zoom(content::PageZoom zoom) { |
252 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); | 252 zoom::PageZoom::Zoom(web_contents_.get(), zoom); |
253 } | 253 } |
OLD | NEW |