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/ui/zoom/zoom_controller.h" | 5 #include "components/ui/zoom/zoom_controller.h" |
6 | 6 |
7 #include "components/ui/zoom/zoom_event_manager.h" | 7 #include "components/ui/zoom/zoom_event_manager.h" |
8 #include "components/ui/zoom/zoom_observer.h" | 8 #include "components/ui/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" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return false; | 89 return false; |
90 | 90 |
91 // Store client data so the |client| can be attributed when the zoom | 91 // Store client data so the |client| can be attributed when the zoom |
92 // change completes. We expect that by the time this function returns that | 92 // change completes. We expect that by the time this function returns that |
93 // any observers that require this information will have requested it. | 93 // any observers that require this information will have requested it. |
94 last_client_ = client; | 94 last_client_ = client; |
95 | 95 |
96 // Do not actually rescale the page in manual mode. | 96 // Do not actually rescale the page in manual mode. |
97 if (zoom_mode_ == ZOOM_MODE_MANUAL) { | 97 if (zoom_mode_ == ZOOM_MODE_MANUAL) { |
98 // If the zoom level hasn't changed, early out to avoid sending an event. | 98 // If the zoom level hasn't changed, early out to avoid sending an event. |
99 if (zoom_level_ == zoom_level) | 99 if (content::ZoomValuesEqual(zoom_level_, zoom_level)) |
100 return true; | 100 return true; |
101 | 101 |
102 double old_zoom_level = zoom_level_; | 102 double old_zoom_level = zoom_level_; |
103 zoom_level_ = zoom_level; | 103 zoom_level_ = zoom_level; |
104 | 104 |
105 // TODO(wjmaclean) Do we care about filling in host/scheme here? | 105 // TODO(wjmaclean) Do we care about filling in host/scheme here? |
106 content::HostZoomMap::ZoomLevelChange change; | 106 content::HostZoomMap::ZoomLevelChange change; |
107 change.mode = content::HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM; | 107 change.mode = content::HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM; |
108 change.zoom_level = zoom_level; | 108 change.zoom_level = zoom_level; |
109 ZoomEventManager::GetForBrowserContext(browser_context_) | 109 ZoomEventManager::GetForBrowserContext(browser_context_) |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); | 346 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); |
347 host_zoom_map_->SetPageScaleFactorIsOneForView( | 347 host_zoom_map_->SetPageScaleFactorIsOneForView( |
348 render_process_id, render_view_id, is_one); | 348 render_process_id, render_view_id, is_one); |
349 } | 349 } |
350 | 350 |
351 bool ZoomController::PageScaleFactorIsOne() const { | 351 bool ZoomController::PageScaleFactorIsOne() const { |
352 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); | 352 return content::HostZoomMap::PageScaleFactorIsOne(web_contents()); |
353 } | 353 } |
354 | 354 |
355 } // namespace ui_zoom | 355 } // namespace ui_zoom |
OLD | NEW |