| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |
| |
| #include "ui/views/controls/image_view.h" |
| |
| class CommandUpdater; |
| |
| class StarView : public views::ImageView { |
| public: |
| explicit StarView(CommandUpdater* command_updater); |
| virtual ~StarView(); |
| |
| // Toggles the star on or off. |
| void SetToggled(bool on); |
| |
| private: |
| // views::ImageView: |
| virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| virtual bool GetTooltipText(const gfx::Point& p, |
| string16* tooltip) const OVERRIDE; |
| virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| |
| // ui::EventHandler: |
| virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| |
| // The CommandUpdater for the Browser object that owns the location bar. |
| CommandUpdater* command_updater_; |
| |
| // This is used to check if the bookmark bubble was showing during the mouse |
| // pressed event. If this is true then the mouse released event is ignored to |
| // prevent the bubble from reshowing. |
| bool suppress_mouse_released_action_; |
| |
| DISALLOW_COPY_AND_ASSIGN(StarView); |
| }; |
| |
| #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ |