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 "components/zoom/zoom_controller.h" | 5 #include "components/zoom/zoom_controller.h" |
6 | 6 |
7 #include "components/zoom/zoom_event_manager.h" | 7 #include "components/zoom/zoom_event_manager.h" |
8 #include "components/zoom/zoom_observer.h" | 8 #include "components/zoom/zoom_observer.h" |
9 #include "content/public/browser/host_zoom_map.h" | 9 #include "content/public/browser/host_zoom_map.h" |
10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
11 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/page_type.h" | 15 #include "content/public/common/page_type.h" |
16 #include "content/public/common/page_zoom.h" | 16 #include "content/public/common/page_zoom.h" |
17 #include "net/base/url_util.h" | 17 #include "net/base/url_util.h" |
18 | 18 |
19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(zoom::ZoomController); | 19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(zoom::ZoomController); |
20 | 20 |
21 namespace zoom { | 21 namespace zoom { |
22 | 22 |
23 double ZoomController::GetZoomLevelForWebContents( | 23 double ZoomController::GetZoomLevelForWebContents( |
24 const content::WebContents* web_contents) { | 24 const content::WebContents* web_contents) { |
25 if (!web_contents) | 25 if (!web_contents) |
26 return 0.0; | 26 return 0.0; |
27 | 27 |
28 auto zoom_controller = FromWebContents(web_contents); | 28 auto* zoom_controller = FromWebContents(web_contents); |
29 if (zoom_controller) | 29 if (zoom_controller) |
30 return zoom_controller->GetZoomLevel(); | 30 return zoom_controller->GetZoomLevel(); |
31 | 31 |
32 return content::HostZoomMap::GetZoomLevel(web_contents); | 32 return content::HostZoomMap::GetZoomLevel(web_contents); |
33 } | 33 } |
34 | 34 |
35 ZoomController::ZoomController(content::WebContents* web_contents) | 35 ZoomController::ZoomController(content::WebContents* web_contents) |
36 : content::WebContentsObserver(web_contents), | 36 : content::WebContentsObserver(web_contents), |
37 can_show_bubble_(true), | 37 can_show_bubble_(true), |
38 zoom_mode_(ZOOM_MODE_DEFAULT), | 38 zoom_mode_(ZOOM_MODE_DEFAULT), |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); | 366 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); |
367 host_zoom_map_->SetPageScaleFactorIsOneForView(render_process_id, | 367 host_zoom_map_->SetPageScaleFactorIsOneForView(render_process_id, |
368 render_view_id, is_one); | 368 render_view_id, is_one); |
369 } | 369 } |
370 | 370 |
371 bool ZoomController::PageScaleFactorIsOne() const { | 371 bool ZoomController::PageScaleFactorIsOne() const { |
372 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); | 372 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); |
373 } | 373 } |
374 | 374 |
375 } // namespace zoom | 375 } // namespace zoom |
OLD | NEW |