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/zoom/zoom_controller.h" | 5 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/zoom/zoom_event_manager.h" | 10 #include "chrome/browser/ui/zoom/zoom_event_manager.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // An extension did not initiate this zoom change. | 86 // An extension did not initiate this zoom change. |
| 87 return SetZoomLevelByExtension(zoom_level, NULL); | 87 return SetZoomLevelByExtension(zoom_level, NULL); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ZoomController::SetZoomLevelByExtension( | 90 bool ZoomController::SetZoomLevelByExtension( |
| 91 double zoom_level, | 91 double zoom_level, |
| 92 const scoped_refptr<const extensions::Extension>& extension) { | 92 const scoped_refptr<const extensions::Extension>& extension) { |
| 93 // Cannot zoom in disabled mode. Also, don't allow changing zoom level on | 93 // Cannot zoom in disabled mode. Also, don't allow changing zoom level on |
| 94 // a crashed tab. | 94 // a crashed tab. |
| 95 if (zoom_mode_ == ZOOM_MODE_DISABLED || | 95 if (zoom_mode_ == ZOOM_MODE_DISABLED || |
| 96 !web_contents()->GetRenderProcessHost()->HasConnection()) | 96 !web_contents()->GetRenderViewHost()->IsRenderViewLive()) |
|
Fady Samuel
2014/09/02 14:27:24
nit: indentation is off
wjmaclean
2014/09/02 14:42:54
Done.
| |
| 97 return false; | 97 return false; |
| 98 | 98 |
| 99 // Store extension data so that |extension| can be attributed when the zoom | 99 // Store extension data so that |extension| can be attributed when the zoom |
| 100 // change completes. We expect that by the time this function returns that | 100 // change completes. We expect that by the time this function returns that |
| 101 // any observers that require this information will have requested it. | 101 // any observers that require this information will have requested it. |
| 102 last_extension_ = extension; | 102 last_extension_ = extension; |
| 103 | 103 |
| 104 // Do not actually rescale the page in manual mode. | 104 // Do not actually rescale the page in manual mode. |
| 105 if (zoom_mode_ == ZOOM_MODE_MANUAL) { | 105 if (zoom_mode_ == ZOOM_MODE_MANUAL) { |
| 106 double old_zoom_level = zoom_level_; | 106 double old_zoom_level = zoom_level_; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 } else { | 298 } else { |
| 299 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and | 299 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and |
| 300 // new zoom levels here? | 300 // new zoom levels here? |
| 301 double zoom_level = GetZoomLevel(); | 301 double zoom_level = GetZoomLevel(); |
| 302 ZoomChangedEventData zoom_change_data( | 302 ZoomChangedEventData zoom_change_data( |
| 303 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); | 303 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); |
| 304 FOR_EACH_OBSERVER( | 304 FOR_EACH_OBSERVER( |
| 305 ZoomObserver, observers_, OnZoomChanged(zoom_change_data)); | 305 ZoomObserver, observers_, OnZoomChanged(zoom_change_data)); |
| 306 } | 306 } |
| 307 } | 307 } |
| OLD | NEW |