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

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: Changed variable naming 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 ZoomObserver* delegate() const { return delegate_; }
36 void set_delegate(ZoomObserver* d) { delegate_ = d; }
tfarina 2012/05/31 23:52:17 nit: set_observer, also please avoid abbreviations
Kyle Horimoto 2012/06/01 00:33:09 Done.
37
38 private:
39 // content::WebContentsObserver overrides:
40 virtual void DidNavigateMainFrame(
41 const content::LoadCommittedDetails& details,
42 const content::FrameNavigateParams& params) OVERRIDE;
43
44 // content::NotificationObserver overrides:
45 virtual void Observe(int type,
46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) OVERRIDE;
48
49 // Updates the zoom icon and zoom percentage based on current values and
50 // notifies the delegate if changes have occurred.
51 void UpdateState();
52
53 // The current zoom icon state.
54 ZoomIconState zoom_icon_state_;
55
56 // The current zoom percentage.
57 int zoom_percent_;
58
59 content::NotificationRegistrar registrar_;
60
61 // Used to access the default zoom level preference.
62 DoublePrefMember default_zoom_level_;
63
64 // Owning TabContentsWrapper.
65 TabContentsWrapper* tab_contents_wrapper_;
66
67 // Delegate receiving notifications on state changes.
tfarina 2012/05/31 23:52:17 nit: s/Delegate/Observer
68 ZoomObserver* delegate_;
tfarina 2012/05/31 23:52:17 nit: s/delegate_/observer_
Kyle Horimoto 2012/06/01 00:33:09 Done.
69
70 DISALLOW_COPY_AND_ASSIGN(ZoomController);
71 };
72
73 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698