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