star_view.h revision 7dbb3d5cf0c15f500944d211057644d6a2f37371
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ 6#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ 7 8#include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" 9#include "ui/views/controls/image_view.h" 10 11class CommandUpdater; 12 13class StarView : public views::ImageView, public TouchableLocationBarView { 14 public: 15 explicit StarView(CommandUpdater* command_updater); 16 virtual ~StarView(); 17 18 // TouchableLocationBarView: 19 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; 20 21 // Toggles the star on or off. 22 void SetToggled(bool on); 23 24 private: 25 // views::ImageView: 26 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 27 virtual bool GetTooltipText(const gfx::Point& p, 28 string16* tooltip) const OVERRIDE; 29 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; 30 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; 31 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 32 33 // ui::EventHandler overrides: 34 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 35 36 // The CommandUpdater for the Browser object that owns the location bar. 37 CommandUpdater* command_updater_; 38 39 // 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 41 // prevent the bubble from reshowing. 42 bool suppress_mouse_released_action_; 43 44 DISALLOW_COPY_AND_ASSIGN(StarView); 45}; 46 47#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_ 48