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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/prefs/pref_member.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/web_contents_observer.h"
15
16 class TabContentsWrapper;
17 class ZoomObserver;
18
19 // Per-tab class to manage the Omnibox zoom icon.
20 class ZoomController : public content::NotificationObserver,
21 public content::WebContentsObserver {
22 public:
23 enum ZoomIconState {
24 NONE = 0,
25 ZOOM_PLUS_ICON,
26 ZOOM_MINUS_ICON,
27 };
28
29 explicit ZoomController(TabContentsWrapper* tab_contents);
30 virtual ~ZoomController();
31
32 ZoomIconState zoom_icon_state() const { return zoom_icon_state_; }
33 int zoom_percent() const { return zoom_percent_; }
34
35 void set_observer(ZoomObserver* observer) { observer_ = observer; }
36
37 private:
38 // content::WebContentsObserver overrides:
39 virtual void DidNavigateMainFrame(
40 const content::LoadCommittedDetails& details,
41 const content::FrameNavigateParams& params) OVERRIDE;
42
43 // content::NotificationObserver overrides:
44 virtual void Observe(int type,
45 const content::NotificationSource& source,
46 const content::NotificationDetails& details) OVERRIDE;
47
48 // Updates the zoom icon and zoom percentage based on current values and
49 // notifies the observer if changes have occurred.
50 void UpdateState();
51
52 // The current zoom icon state.
53 ZoomIconState zoom_icon_state_;
54
55 // The current zoom percentage.
56 int zoom_percent_;
57
58 content::NotificationRegistrar registrar_;
59
60 // Used to access the default zoom level preference.
61 DoublePrefMember default_zoom_level_;
62
63 // TabContentsWrapper that owns this instance.
64 TabContentsWrapper* tab_contents_wrapper_;
65
66 // Observer receiving notifications on state changes.
67 ZoomObserver* observer_;
68
69 DISALLOW_COPY_AND_ASSIGN(ZoomController);
70 };
71
72 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
OLDNEW
« 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