Switch ZoomTabHelper to use WebContentsUserData.

BUG=107201
TEST=no visible change


Review URL: https://chromiumcodereview.appspot.com/10959054

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158510 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/zoom/zoom_controller.h b/chrome/browser/ui/zoom/zoom_controller.h
index f3d8415..1431763 100644
--- a/chrome/browser/ui/zoom/zoom_controller.h
+++ b/chrome/browser/ui/zoom/zoom_controller.h
@@ -8,18 +8,22 @@
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "chrome/browser/api/prefs/pref_member.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "content/public/browser/web_contents_observer.h"
 
-class TabContents;
 class ZoomObserver;
 
+namespace content {
+class WebContents;
+}
+
 // Per-tab class to manage the Omnibox zoom icon.
 class ZoomController : public content::NotificationObserver,
-                       public content::WebContentsObserver {
+                       public content::WebContentsObserver,
+                       public WebContentsUserData<ZoomController> {
  public:
-  explicit ZoomController(TabContents* tab_contents);
   virtual ~ZoomController();
 
   int zoom_percent() const { return zoom_percent_; }
@@ -33,6 +37,10 @@
   void set_observer(ZoomObserver* observer) { observer_ = observer; }
 
  private:
+  explicit ZoomController(content::WebContents* web_contents);
+  static int kUserDataKey;
+  friend class WebContentsUserData<ZoomController>;
+
   // content::WebContentsObserver overrides:
   virtual void DidNavigateMainFrame(
       const content::LoadCommittedDetails& details,
@@ -59,9 +67,6 @@
   // Used to access the default zoom level preference.
   DoublePrefMember default_zoom_level_;
 
-  // TabContents that owns this instance.
-  TabContents* tab_contents_;
-
   // Observer receiving notifications on state changes.
   ZoomObserver* observer_;