| 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_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 11 #include "chrome/browser/ui/zoom/zoom_controller.h" | 11 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 12 #include "ui/views/controls/image_view.h" | 12 #include "ui/views/controls/image_view.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class KeyEvent; | 15 class KeyEvent; |
| 16 class MouseEvent; | 16 class MouseEvent; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // View for the zoom icon in the Omnibox. | 19 // View for the zoom icon in the Omnibox. |
| 20 class ZoomView : public views::ImageView { | 20 class ZoomView : public views::ImageView { |
| 21 public: | 21 public: |
| 22 explicit ZoomView(ToolbarModel* toolbar_model); | 22 explicit ZoomView(ToolbarModel* toolbar_model); |
| 23 virtual ~ZoomView(); | 23 virtual ~ZoomView(); |
| 24 | 24 |
| 25 void SetZoomIconState(ZoomController::ZoomIconState zoom_icon_state); | |
| 26 void SetZoomIconTooltipPercent(int zoom_percent); | |
| 27 | |
| 28 // Updates the image and its tooltip appropriately, hiding or showing the icon | 25 // Updates the image and its tooltip appropriately, hiding or showing the icon |
| 29 // as needed. | 26 // as needed. |
| 30 void Update(); | 27 void Update(ZoomController* zoom_controller); |
| 31 | 28 |
| 32 private: | 29 private: |
| 33 // views::ImageView: | 30 // views::ImageView: |
| 34 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 31 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 35 virtual bool GetTooltipText(const gfx::Point& p, | 32 virtual bool GetTooltipText(const gfx::Point& p, |
| 36 string16* tooltip) const OVERRIDE; | 33 string16* tooltip) const OVERRIDE; |
| 37 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 34 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 38 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 35 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 39 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 36 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 40 | 37 |
| 41 // Toolbar model used to test whether location bar input is in progress. | 38 // Toolbar model used to test whether location bar input is in progress. |
| 42 ToolbarModel* toolbar_model_; | 39 ToolbarModel* toolbar_model_; |
| 43 | 40 |
| 44 // The current icon state. | |
| 45 ZoomController::ZoomIconState zoom_icon_state_; | |
| 46 | |
| 47 // The current zoom percentage. | |
| 48 int zoom_percent_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(ZoomView); | 41 DISALLOW_COPY_AND_ASSIGN(ZoomView); |
| 51 }; | 42 }; |
| 52 | 43 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ | 44 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| OLD | NEW |