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

Side by Side Diff: chrome/browser/ui/zoom/zoom_tab_helper.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: Created 8 years, 7 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_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_TAB_HELPER_H_
7 #pragma once
8
9 #include "chrome/browser/prefs/pref_member.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/web_contents_observer.h"
13
14 class TabContentsWrapper;
15 class ZoomTabHelperDelegate;
16
17 // Per-tab class to manage the Omnibox zoom icon.
18 class ZoomTabHelper : public content::NotificationObserver,
Ben Goodger (Google) 2012/05/29 18:04:41 ZoomController
Kyle Horimoto 2012/05/31 23:13:52 Done.
19 public content::WebContentsObserver {
20 public:
21 explicit ZoomTabHelper(TabContentsWrapper* tab_contents);
22 virtual ~ZoomTabHelper();
23
24 enum ZoomIconState {
tfarina 2012/05/29 18:09:12 nit: this should goes first in this section (i.e,
Kyle Horimoto 2012/05/31 23:13:52 Done.
25 NONE = 0,
26 ZOOM_PLUS_ICON,
27 ZOOM_MINUS_ICON,
28 };
29
30 ZoomIconState zoom_icon_status() const { return zoom_icon_state_; }
tfarina 2012/05/29 18:09:12 nit: zoom_icon_state()
Kyle Horimoto 2012/05/31 23:13:52 Done.
31 int zoom_percent() const { return zoom_percent_; }
32
33 ZoomTabHelperDelegate* delegate() const { return delegate_; }
34 void set_delegate(ZoomTabHelperDelegate* d) { delegate_ = d; }
35
36 // content::WebContentsObserver overrides:
37 virtual void DidNavigateMainFrame(
tfarina 2012/05/29 18:09:12 I bet you can make this and Observe private.
Kyle Horimoto 2012/05/31 23:13:52 Done.
38 const content::LoadCommittedDetails& details,
39 const content::FrameNavigateParams& params) OVERRIDE;
tfarina 2012/05/29 18:09:12 include compiler_specific.h for OVERRIDE
Kyle Horimoto 2012/05/31 23:13:52 Done.
40
41 // content::NotificationObserver overrides:
42 virtual void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) OVERRIDE;
45
46 private:
47 // Updates the zoom icon and zoom percentage based on current values and
48 // notifies the delegate if changes have occurred.
49 void UpdateState();
50
51 // The current zoom icon state.
52 ZoomIconState zoom_icon_state_;
53
54 // The current zoom percentage.
55 int zoom_percent_;
56
57 // Registers and unregisters notifications.
tfarina 2012/05/29 18:09:12 nit: I'd remove this comment, it doesn't add much,
Kyle Horimoto 2012/05/31 23:13:52 Done.
58 content::NotificationRegistrar registrar_;
59
60 // Used to access the default zoom level preference.
61 DoublePrefMember default_zoom_level_;
62
63 // Owning TabContentsWrapper.
tfarina 2012/05/29 18:09:12 I guess you don't own TabContentsWrapper.
Kyle Horimoto 2012/05/31 23:13:52 No, it owns this.
tfarina 2012/05/31 23:21:00 You don't own TabContentsWrapper. This is a weak p
Kyle Horimoto 2012/05/31 23:37:20 Not quite sure what you're trying to say here. Thi
64 TabContentsWrapper* tab_contents_wrapper_;
Ben Goodger (Google) 2012/05/29 18:04:41 you don't appear to use this as a TabContentsWrapp
Kyle Horimoto 2012/05/31 23:13:52 Actually, I do use it as a TabContentsWrapper. It
65
66 // Delegate receiving notifications on state changes.
67 ZoomTabHelperDelegate* delegate_;
68
69 DISALLOW_COPY_AND_ASSIGN(ZoomTabHelper);
tfarina 2012/05/29 18:09:12 include basictypes.h for this.
Kyle Horimoto 2012/05/31 23:13:52 Done.
70 };
71
72 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698