Chromium Code Reviews| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 10 #include "chrome/browser/ui/zoom/zoom_controller.h" | 10 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 11 #include "ui/views/controls/image_view.h" | 11 #include "ui/views/controls/image_view.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class KeyEvent; | 14 class KeyEvent; |
| 15 class MouseEvent; | 15 class MouseEvent; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // View for the zoom icon in the Omnibox. | 18 // View for the zoom icon in the Omnibox. |
| 19 class ZoomView : public views::ImageView { | 19 class ZoomView : public views::ImageView { |
| 20 public: | 20 public: |
| 21 explicit ZoomView(ToolbarModel* toolbar_model); | 21 explicit ZoomView(ToolbarModel* toolbar_model); |
| 22 virtual ~ZoomView(); | 22 virtual ~ZoomView(); |
| 23 | 23 |
| 24 void SetZoomIconState(ZoomController::ZoomIconState zoom_icon_state); | |
| 25 void SetZoomIconTooltipPercent(int zoom_percent); | |
| 26 | |
| 27 // Updates the image and its tooltip appropriately, hiding or showing the icon | 24 // Updates the image and its tooltip appropriately, hiding or showing the icon |
| 28 // as needed. | 25 // as needed. |
| 29 void Update(); | 26 void Update(ZoomController* zoom_controller); |
| 30 | 27 |
| 31 private: | 28 private: |
| 32 // views::ImageView: | 29 // views::ImageView: |
| 33 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 30 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 34 virtual bool GetTooltipText(const gfx::Point& p, | 31 virtual bool GetTooltipText(const gfx::Point& p, |
| 35 string16* tooltip) const OVERRIDE; | 32 string16* tooltip) const OVERRIDE; |
| 36 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | |
|
Kyle Horimoto
2012/07/24 03:22:28
Why are we getting rid of all these mouse event ha
Dan Beam
2012/08/15 09:04:59
I've added them back now that the code compiles wi
| |
| 37 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | |
| 38 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | |
| 39 | 33 |
| 40 // Toolbar model used to test whether location bar input is in progress. | 34 // Toolbar model used to test whether location bar input is in progress. |
| 41 ToolbarModel* toolbar_model_; | 35 ToolbarModel* toolbar_model_; |
| 42 | 36 |
| 43 // The current icon state. | |
| 44 ZoomController::ZoomIconState zoom_icon_state_; | |
| 45 | |
| 46 // The current zoom percentage. | |
| 47 int zoom_percent_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(ZoomView); | 37 DISALLOW_COPY_AND_ASSIGN(ZoomView); |
| 50 }; | 38 }; |
| 51 | 39 |
| 52 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ | 40 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| OLD | NEW |