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