OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/views/info_bubble.h" | 8 #include "chrome/browser/views/info_bubble.h" |
9 #include "views/controls/image_view.h" | 9 #include "views/controls/image_view.h" |
10 | 10 |
11 class CommandUpdater; | 11 class CommandUpdater; |
12 class InfoBubble; | 12 class InfoBubble; |
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 class StarView : public views::ImageView, public InfoBubbleDelegate { | 19 class StarView : public views::ImageView, public InfoBubbleDelegate { |
20 public: | 20 public: |
21 explicit StarView(CommandUpdater* command_updater); | 21 explicit StarView(CommandUpdater* command_updater); |
22 virtual ~StarView(); | 22 virtual ~StarView(); |
23 | 23 |
24 // Toggles the star on or off. | 24 // Toggles the star on or off. |
25 void SetToggled(bool on); | 25 void SetToggled(bool on); |
26 | 26 |
27 private: | 27 private: |
28 // views::ImageView overrides: | 28 // views::ImageView overrides: |
29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); | 29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 30 virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); |
30 virtual bool OnMousePressed(const views::MouseEvent& event); | 31 virtual bool OnMousePressed(const views::MouseEvent& event); |
31 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 32 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
32 virtual bool OnKeyPressed(const views::KeyEvent& e); | 33 virtual bool OnKeyPressed(const views::KeyEvent& e); |
33 | 34 |
34 // InfoBubbleDelegate overrides: | 35 // InfoBubbleDelegate overrides: |
35 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 36 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
36 bool closed_by_escape); | 37 bool closed_by_escape); |
37 virtual bool CloseOnEscape(); | 38 virtual bool CloseOnEscape(); |
38 virtual bool FadeInOnShow() { return false; } | 39 virtual bool FadeInOnShow() { return false; } |
39 | 40 |
40 // The CommandUpdater for the Browser object that owns the location bar. | 41 // The CommandUpdater for the Browser object that owns the location bar. |
41 CommandUpdater* command_updater_; | 42 CommandUpdater* command_updater_; |
42 | 43 |
43 DISALLOW_IMPLICIT_CONSTRUCTORS(StarView); | 44 DISALLOW_IMPLICIT_CONSTRUCTORS(StarView); |
44 }; | 45 }; |
45 | 46 |
46 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 47 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
OLD | NEW |