OLD | NEW |
(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_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 11 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 12 #include "ui/views/controls/image_view.h" |
| 13 |
| 14 namespace views { |
| 15 class KeyEvent; |
| 16 class MouseEvent; |
| 17 } |
| 18 |
| 19 // View for the zoom icon in the Omnibox. |
| 20 class ZoomView : public views::ImageView { |
| 21 public: |
| 22 explicit ZoomView(ToolbarModel* toolbar_model); |
| 23 virtual ~ZoomView(); |
| 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 |
| 29 // as needed. |
| 30 void Update(); |
| 31 |
| 32 private: |
| 33 // views::ImageView: |
| 34 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 35 virtual bool GetTooltipText(const gfx::Point& p, |
| 36 string16* tooltip) const OVERRIDE; |
| 37 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 38 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 39 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 40 |
| 41 // Toolbar model used to test whether location bar input is in progress. |
| 42 ToolbarModel* toolbar_model_; |
| 43 |
| 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); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ |
OLD | NEW |