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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/chrome_page_zoom.h" | |
12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
13 #include "chrome/browser/extensions/window_controller.h" | 12 #include "chrome/browser/extensions/window_controller.h" |
14 #include "chrome/browser/favicon/favicon_tab_helper.h" | 13 #include "chrome/browser/favicon/favicon_tab_helper.h" |
15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sessions/session_tab_helper.h" | 15 #include "chrome/browser/sessions/session_tab_helper.h" |
17 #include "chrome/browser/ui/browser_navigator.h" | 16 #include "chrome/browser/ui/browser_navigator.h" |
18 #include "chrome/browser/ui/panels/panel.h" | 17 #include "chrome/browser/ui/panels/panel.h" |
19 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 18 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 19 #include "components/ui/zoom/page_zoom.h" |
20 #include "components/ui/zoom/zoom_controller.h" | 20 #include "components/ui/zoom/zoom_controller.h" |
21 #include "content/public/browser/invalidate_type.h" | 21 #include "content/public/browser/invalidate_type.h" |
22 #include "content/public/browser/navigation_controller.h" | 22 #include "content/public/browser/navigation_controller.h" |
23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
25 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/site_instance.h" | 27 #include "content/public/browser/site_instance.h" |
28 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
(...skipping 18 matching lines...) Expand all Loading... |
48 | 48 |
49 void PanelHost::Init(const GURL& url) { | 49 void PanelHost::Init(const GURL& url) { |
50 if (url.is_empty()) | 50 if (url.is_empty()) |
51 return; | 51 return; |
52 | 52 |
53 content::WebContents::CreateParams create_params( | 53 content::WebContents::CreateParams create_params( |
54 profile_, content::SiteInstance::CreateForURL(profile_, url)); | 54 profile_, content::SiteInstance::CreateForURL(profile_, url)); |
55 web_contents_.reset(content::WebContents::Create(create_params)); | 55 web_contents_.reset(content::WebContents::Create(create_params)); |
56 extensions::SetViewType(web_contents_.get(), extensions::VIEW_TYPE_PANEL); | 56 extensions::SetViewType(web_contents_.get(), extensions::VIEW_TYPE_PANEL); |
57 web_contents_->SetDelegate(this); | 57 web_contents_->SetDelegate(this); |
58 // web_contents_ may be passed to chrome_page_zoom::Zoom(), so it needs | 58 // web_contents_ may be passed to PageZoom::Zoom(), so it needs |
59 // a ZoomController. | 59 // a ZoomController. |
60 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); | 60 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); |
61 content::WebContentsObserver::Observe(web_contents_.get()); | 61 content::WebContentsObserver::Observe(web_contents_.get()); |
62 | 62 |
63 // Needed to give the web contents a Tab ID. Extension APIs | 63 // Needed to give the web contents a Tab ID. Extension APIs |
64 // expect web contents to have a Tab ID. | 64 // expect web contents to have a Tab ID. |
65 SessionTabHelper::CreateForWebContents(web_contents_.get()); | 65 SessionTabHelper::CreateForWebContents(web_contents_.get()); |
66 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( | 66 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( |
67 panel_->session_id()); | 67 panel_->session_id()); |
68 | 68 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 content::RecordAction(UserMetricsAction("ReloadIgnoringCache")); | 262 content::RecordAction(UserMetricsAction("ReloadIgnoringCache")); |
263 web_contents_->GetController().ReloadIgnoringCache(true); | 263 web_contents_->GetController().ReloadIgnoringCache(true); |
264 } | 264 } |
265 | 265 |
266 void PanelHost::StopLoading() { | 266 void PanelHost::StopLoading() { |
267 content::RecordAction(UserMetricsAction("Stop")); | 267 content::RecordAction(UserMetricsAction("Stop")); |
268 web_contents_->Stop(); | 268 web_contents_->Stop(); |
269 } | 269 } |
270 | 270 |
271 void PanelHost::Zoom(content::PageZoom zoom) { | 271 void PanelHost::Zoom(content::PageZoom zoom) { |
272 chrome_page_zoom::Zoom(web_contents_.get(), zoom); | 272 ui_zoom::PageZoom::Zoom(web_contents_.get(), zoom); |
273 } | 273 } |
OLD | NEW |