 Chromium Code Reviews
 Chromium Code Reviews Issue 12315069:
  Mac: Update zoom bubble UI  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 12315069:
  Mac: Update zoom bubble UI  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" | 
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" | 
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 browser_context_)->RemoveZoomLevelChangedCallback( | 47 browser_context_)->RemoveZoomLevelChangedCallback( | 
| 48 zoom_callback_); | 48 zoom_callback_); | 
| 49 } | 49 } | 
| 50 | 50 | 
| 51 bool ZoomController::IsAtDefaultZoom() const { | 51 bool ZoomController::IsAtDefaultZoom() const { | 
| 52 return content::ZoomValuesEqual(web_contents()->GetZoomLevel(), | 52 return content::ZoomValuesEqual(web_contents()->GetZoomLevel(), | 
| 53 default_zoom_level_.GetValue()); | 53 default_zoom_level_.GetValue()); | 
| 54 } | 54 } | 
| 55 | 55 | 
| 56 int ZoomController::GetResourceForZoomLevel() const { | 56 int ZoomController::GetResourceForZoomLevel() const { | 
| 57 DCHECK(!IsAtDefaultZoom()); | |
| 58 double zoom = web_contents()->GetZoomLevel(); | 57 double zoom = web_contents()->GetZoomLevel(); | 
| 59 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; | 58 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; | 
| 
Dan Beam
2013/02/26 00:17:49
is it reasonable to return + or - when the zoom is
 
sail
2013/02/26 03:10:36
Done.
Good point. Changed to use IDR_ZOOM_NORMAL.
 | |
| 60 } | 59 } | 
| 61 | 60 | 
| 62 void ZoomController::DidNavigateMainFrame( | 61 void ZoomController::DidNavigateMainFrame( | 
| 63 const content::LoadCommittedDetails& details, | 62 const content::LoadCommittedDetails& details, | 
| 64 const content::FrameNavigateParams& params) { | 63 const content::FrameNavigateParams& params) { | 
| 65 // If the main frame's content has changed, the new page may have a different | 64 // If the main frame's content has changed, the new page may have a different | 
| 66 // zoom level from the old one. | 65 // zoom level from the old one. | 
| 67 UpdateState(std::string()); | 66 UpdateState(std::string()); | 
| 68 } | 67 } | 
| 69 | 68 | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 83 return; | 82 return; | 
| 84 } | 83 } | 
| 85 } | 84 } | 
| 86 | 85 | 
| 87 bool dummy; | 86 bool dummy; | 
| 88 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); | 87 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); | 
| 89 | 88 | 
| 90 if (observer_) | 89 if (observer_) | 
| 91 observer_->OnZoomChanged(web_contents(), !host.empty()); | 90 observer_->OnZoomChanged(web_contents(), !host.empty()); | 
| 92 } | 91 } | 
| OLD | NEW |