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

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

Issue 10444040: Tracks changes to zoom icon and zoom percentage. Notifies browser window if the icon should be chan… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/zoom/zoom_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/zoom/zoom_controller.h
diff --git a/chrome/browser/ui/zoom/zoom_controller.h b/chrome/browser/ui/zoom/zoom_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd0e9a1103ee272abe8e71dda963ad8dff041266
--- /dev/null
+++ b/chrome/browser/ui/zoom/zoom_controller.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
+#define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/web_contents_observer.h"
+
+class TabContentsWrapper;
+class ZoomObserver;
+
+// Per-tab class to manage the Omnibox zoom icon.
+class ZoomController : public content::NotificationObserver,
+ public content::WebContentsObserver {
+ public:
+ enum ZoomIconState {
+ NONE = 0,
+ ZOOM_PLUS_ICON,
+ ZOOM_MINUS_ICON,
+ };
+
+ explicit ZoomController(TabContentsWrapper* tab_contents);
+ virtual ~ZoomController();
+
+ ZoomIconState zoom_icon_state() const { return zoom_icon_state_; }
+ int zoom_percent() const { return zoom_percent_; }
+
+ void set_observer(ZoomObserver* observer) { observer_ = observer; }
+
+ private:
+ // content::WebContentsObserver overrides:
+ virtual void DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) OVERRIDE;
+
+ // content::NotificationObserver overrides:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // Updates the zoom icon and zoom percentage based on current values and
+ // notifies the observer if changes have occurred.
+ void UpdateState();
+
+ // The current zoom icon state.
+ ZoomIconState zoom_icon_state_;
+
+ // The current zoom percentage.
+ int zoom_percent_;
+
+ content::NotificationRegistrar registrar_;
+
+ // Used to access the default zoom level preference.
+ DoublePrefMember default_zoom_level_;
+
+ // TabContentsWrapper that owns this instance.
+ TabContentsWrapper* tab_contents_wrapper_;
+
+ // Observer receiving notifications on state changes.
+ ZoomObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ZoomController);
+};
+
+#endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/zoom/zoom_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698