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