| 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" | |
| 9 #include "ui/views/controls/image_view.h" | 8 #include "ui/views/controls/image_view.h" |
| 10 | 9 |
| 11 class CommandUpdater; | 10 class CommandUpdater; |
| 12 | 11 |
| 13 class StarView : public views::ImageView, public TouchableLocationBarView { | 12 class StarView : public views::ImageView { |
| 14 public: | 13 public: |
| 15 explicit StarView(CommandUpdater* command_updater); | 14 explicit StarView(CommandUpdater* command_updater); |
| 16 virtual ~StarView(); | 15 virtual ~StarView(); |
| 17 | 16 |
| 18 // TouchableLocationBarView: | |
| 19 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | |
| 20 | |
| 21 // Toggles the star on or off. | 17 // Toggles the star on or off. |
| 22 void SetToggled(bool on); | 18 void SetToggled(bool on); |
| 23 | 19 |
| 24 private: | 20 private: |
| 25 // views::ImageView: | 21 // views::ImageView: |
| 26 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 22 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 27 virtual bool GetTooltipText(const gfx::Point& p, | 23 virtual bool GetTooltipText(const gfx::Point& p, |
| 28 string16* tooltip) const OVERRIDE; | 24 string16* tooltip) const OVERRIDE; |
| 29 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 25 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 30 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 26 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 31 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 27 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 32 | 28 |
| 33 // ui::EventHandler overrides: | 29 // ui::EventHandler: |
| 34 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 30 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 35 | 31 |
| 36 // The CommandUpdater for the Browser object that owns the location bar. | 32 // The CommandUpdater for the Browser object that owns the location bar. |
| 37 CommandUpdater* command_updater_; | 33 CommandUpdater* command_updater_; |
| 38 | 34 |
| 39 // This is used to check if the bookmark bubble was showing during the mouse | 35 // This is used to check if the bookmark bubble was showing during the mouse |
| 40 // pressed event. If this is true then the mouse released event is ignored to | 36 // pressed event. If this is true then the mouse released event is ignored to |
| 41 // prevent the bubble from reshowing. | 37 // prevent the bubble from reshowing. |
| 42 bool suppress_mouse_released_action_; | 38 bool suppress_mouse_released_action_; |
| 43 | 39 |
| 44 DISALLOW_COPY_AND_ASSIGN(StarView); | 40 DISALLOW_COPY_AND_ASSIGN(StarView); |
| 45 }; | 41 }; |
| 46 | 42 |
| 47 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ | 43 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| OLD | NEW |