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

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

Issue 287093002: Remove ViewMsg_SetZoomLevel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add std:: namespace to find() to fix Android compile. Created 6 years, 6 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_login_handler.cc ('k') | content/browser/host_zoom_map_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 26 matching lines...) Expand all
37 browser_context_)->AddZoomLevelChangedCallback( 37 browser_context_)->AddZoomLevelChangedCallback(
38 base::Bind(&ZoomController::OnZoomLevelChanged, 38 base::Bind(&ZoomController::OnZoomLevelChanged,
39 base::Unretained(this))); 39 base::Unretained(this)));
40 40
41 UpdateState(std::string()); 41 UpdateState(std::string());
42 } 42 }
43 43
44 ZoomController::~ZoomController() {} 44 ZoomController::~ZoomController() {}
45 45
46 bool ZoomController::IsAtDefaultZoom() const { 46 bool ZoomController::IsAtDefaultZoom() const {
47 return content::ZoomValuesEqual(web_contents()->GetZoomLevel(), 47 return content::ZoomValuesEqual(
48 default_zoom_level_.GetValue()); 48 content::HostZoomMap::GetZoomLevel(web_contents()),
49 default_zoom_level_.GetValue());
49 } 50 }
50 51
51 int ZoomController::GetResourceForZoomLevel() const { 52 int ZoomController::GetResourceForZoomLevel() const {
52 if (IsAtDefaultZoom()) 53 if (IsAtDefaultZoom())
53 return IDR_ZOOM_NORMAL; 54 return IDR_ZOOM_NORMAL;
54 double zoom = web_contents()->GetZoomLevel(); 55 double zoom = content::HostZoomMap::GetZoomLevel(web_contents());
55 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; 56 return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS;
56 } 57 }
57 58
58 void ZoomController::DidNavigateMainFrame( 59 void ZoomController::DidNavigateMainFrame(
59 const content::LoadCommittedDetails& details, 60 const content::LoadCommittedDetails& details,
60 const content::FrameNavigateParams& params) { 61 const content::FrameNavigateParams& params) {
61 // If the main frame's content has changed, the new page may have a different 62 // If the main frame's content has changed, the new page may have a different
62 // zoom level from the old one. 63 // zoom level from the old one.
63 UpdateState(std::string()); 64 UpdateState(std::string());
64 } 65 }
(...skipping 15 matching lines...) Expand all
80 return; 81 return;
81 } 82 }
82 } 83 }
83 84
84 bool dummy; 85 bool dummy;
85 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); 86 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
86 87
87 if (observer_) 88 if (observer_)
88 observer_->OnZoomChanged(web_contents(), !host.empty()); 89 observer_->OnZoomChanged(web_contents(), !host.empty());
89 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_login_handler.cc ('k') | content/browser/host_zoom_map_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698