| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/prefs/pref_member.h" | 11 #include "chrome/browser/prefs/pref_member.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 | 15 |
| 16 class TabContents; | 16 class TabContents; |
| 17 typedef TabContents TabContentsWrapper; | |
| 18 class ZoomObserver; | 17 class ZoomObserver; |
| 19 | 18 |
| 20 // Per-tab class to manage the Omnibox zoom icon. | 19 // Per-tab class to manage the Omnibox zoom icon. |
| 21 class ZoomController : public content::NotificationObserver, | 20 class ZoomController : public content::NotificationObserver, |
| 22 public content::WebContentsObserver { | 21 public content::WebContentsObserver { |
| 23 public: | 22 public: |
| 24 enum ZoomIconState { | 23 enum ZoomIconState { |
| 25 NONE = 0, | 24 NONE = 0, |
| 26 ZOOM_PLUS_ICON, | 25 ZOOM_PLUS_ICON, |
| 27 ZOOM_MINUS_ICON, | 26 ZOOM_MINUS_ICON, |
| 28 }; | 27 }; |
| 29 | 28 |
| 30 explicit ZoomController(TabContentsWrapper* tab_contents); | 29 explicit ZoomController(TabContents* tab_contents); |
| 31 virtual ~ZoomController(); | 30 virtual ~ZoomController(); |
| 32 | 31 |
| 33 ZoomIconState zoom_icon_state() const { return zoom_icon_state_; } | 32 ZoomIconState zoom_icon_state() const { return zoom_icon_state_; } |
| 34 int zoom_percent() const { return zoom_percent_; } | 33 int zoom_percent() const { return zoom_percent_; } |
| 35 | 34 |
| 36 void set_observer(ZoomObserver* observer) { observer_ = observer; } | 35 void set_observer(ZoomObserver* observer) { observer_ = observer; } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 // content::WebContentsObserver overrides: | 38 // content::WebContentsObserver overrides: |
| 40 virtual void DidNavigateMainFrame( | 39 virtual void DidNavigateMainFrame( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 ZoomIconState zoom_icon_state_; | 53 ZoomIconState zoom_icon_state_; |
| 55 | 54 |
| 56 // The current zoom percentage. | 55 // The current zoom percentage. |
| 57 int zoom_percent_; | 56 int zoom_percent_; |
| 58 | 57 |
| 59 content::NotificationRegistrar registrar_; | 58 content::NotificationRegistrar registrar_; |
| 60 | 59 |
| 61 // Used to access the default zoom level preference. | 60 // Used to access the default zoom level preference. |
| 62 DoublePrefMember default_zoom_level_; | 61 DoublePrefMember default_zoom_level_; |
| 63 | 62 |
| 64 // TabContentsWrapper that owns this instance. | 63 // TabContents that owns this instance. |
| 65 TabContentsWrapper* tab_contents_wrapper_; | 64 TabContents* tab_contents_; |
| 66 | 65 |
| 67 // Observer receiving notifications on state changes. | 66 // Observer receiving notifications on state changes. |
| 68 ZoomObserver* observer_; | 67 ZoomObserver* observer_; |
| 69 | 68 |
| 70 DISALLOW_COPY_AND_ASSIGN(ZoomController); | 69 DISALLOW_COPY_AND_ASSIGN(ZoomController); |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ | 72 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_CONTROLLER_H_ |
| OLD | NEW |