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

Unified Diff: chrome/browser/ui/zoom/zoom_controller.cc

Issue 10959054: Switch ZoomTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller.h ('k') | chrome/browser/ui/zoom/zoom_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/zoom/zoom_controller.cc
diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc
index b52581fd30e503f32c68a8b8ea3f402ae546176d..949e7b547d42f191039dd71053ab7eb6fb460e27 100644
--- a/chrome/browser/ui/zoom/zoom_controller.cc
+++ b/chrome/browser/ui/zoom/zoom_controller.cc
@@ -17,13 +17,16 @@
#include "content/public/common/page_zoom.h"
#include "grit/theme_resources.h"
-ZoomController::ZoomController(TabContents* tab_contents)
- : content::WebContentsObserver(tab_contents->web_contents()),
+int ZoomController::kUserDataKey;
+
+ZoomController::ZoomController(content::WebContents* web_contents)
+ : content::WebContentsObserver(web_contents),
zoom_percent_(100),
- tab_contents_(tab_contents),
observer_(NULL) {
default_zoom_level_.Init(prefs::kDefaultZoomLevel,
- tab_contents->profile()->GetPrefs(), this);
+ Profile::FromBrowserContext(
+ web_contents->GetBrowserContext())->GetPrefs(),
+ this);
registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
content::NotificationService::AllBrowserContextsAndSources());
@@ -36,13 +39,13 @@ ZoomController::~ZoomController() {
}
bool ZoomController::IsAtDefaultZoom() const {
- return content::ZoomValuesEqual(tab_contents_->web_contents()->GetZoomLevel(),
+ return content::ZoomValuesEqual(web_contents()->GetZoomLevel(),
default_zoom_level_.GetValue());
}
int ZoomController::GetResourceForZoomLevel() const {
DCHECK(!IsAtDefaultZoom());
- double zoom = tab_contents_->web_contents()->GetZoomLevel();
+ double zoom = web_contents()->GetZoomLevel();
return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS;
}
@@ -74,8 +77,8 @@ void ZoomController::Observe(int type,
void ZoomController::UpdateState(bool can_show_bubble) {
bool dummy;
- zoom_percent_ = tab_contents_->web_contents()->GetZoomPercent(&dummy, &dummy);
+ zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
if (observer_)
- observer_->OnZoomChanged(tab_contents_, can_show_bubble);
+ observer_->OnZoomChanged(web_contents(), can_show_bubble);
}
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller.h ('k') | chrome/browser/ui/zoom/zoom_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698