Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/ui/zoom/zoom_controller.cc

Issue 12315069: Mac: Update zoom bubble UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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();
58 if (IsAtDefaultZoom())
59 return IDR_ZOOM_NORMAL;
Dan Beam 2013/02/26 18:36:31 if (IsAtDefaultZoom()) return IDR_ZOOM_NORMAL;
sail 2013/02/26 22:04:15 Done.
59 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; 60 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS;
60 } 61 }
61 62
62 void ZoomController::DidNavigateMainFrame( 63 void ZoomController::DidNavigateMainFrame(
63 const content::LoadCommittedDetails& details, 64 const content::LoadCommittedDetails& details,
64 const content::FrameNavigateParams& params) { 65 const content::FrameNavigateParams& params) {
65 // If the main frame's content has changed, the new page may have a different 66 // If the main frame's content has changed, the new page may have a different
66 // zoom level from the old one. 67 // zoom level from the old one.
67 UpdateState(std::string()); 68 UpdateState(std::string());
68 } 69 }
(...skipping 14 matching lines...) Expand all
83 return; 84 return;
84 } 85 }
85 } 86 }
86 87
87 bool dummy; 88 bool dummy;
88 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); 89 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
89 90
90 if (observer_) 91 if (observer_)
91 observer_->OnZoomChanged(web_contents(), !host.empty()); 92 observer_->OnZoomChanged(web_contents(), !host.empty());
92 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698