| 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_STAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" |
| 9 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| 10 | 11 |
| 11 class CommandUpdater; | 12 class CommandUpdater; |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 class KeyEvent; | 15 class KeyEvent; |
| 15 class MouseEvent; | 16 class MouseEvent; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class StarView : public views::ImageView { | 19 class StarView |
| 20 : public views::ImageView, |
| 21 public TouchableLocationBarView { |
| 19 public: | 22 public: |
| 20 explicit StarView(CommandUpdater* command_updater); | 23 explicit StarView(CommandUpdater* command_updater); |
| 21 virtual ~StarView(); | 24 virtual ~StarView(); |
| 22 | 25 |
| 23 // Toggles the star on or off. | 26 // Toggles the star on or off. |
| 24 void SetToggled(bool on); | 27 void SetToggled(bool on); |
| 25 | 28 |
| 29 // TouchableLocationBarView. |
| 30 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; |
| 31 |
| 26 private: | 32 private: |
| 27 // views::ImageView overrides: | 33 // views::ImageView overrides: |
| 28 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 34 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 29 virtual bool GetTooltipText(const gfx::Point& p, | 35 virtual bool GetTooltipText(const gfx::Point& p, |
| 30 string16* tooltip) const OVERRIDE; | 36 string16* tooltip) const OVERRIDE; |
| 31 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 37 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 32 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 38 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 33 virtual ui::GestureStatus OnGestureEvent( | 39 virtual ui::GestureStatus OnGestureEvent( |
| 34 const views::GestureEvent& event) OVERRIDE; | 40 const views::GestureEvent& event) OVERRIDE; |
| 35 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 41 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 36 | 42 |
| 37 // The CommandUpdater for the Browser object that owns the location bar. | 43 // The CommandUpdater for the Browser object that owns the location bar. |
| 38 CommandUpdater* command_updater_; | 44 CommandUpdater* command_updater_; |
| 39 | 45 |
| 40 DISALLOW_IMPLICIT_CONSTRUCTORS(StarView); | 46 DISALLOW_IMPLICIT_CONSTRUCTORS(StarView); |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 49 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| OLD | NEW |