Home | History | Annotate | Download | only in location_bar
      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 "ui/views/controls/image_view.h"
      9 
     10 class CommandUpdater;
     11 
     12 class StarView : public views::ImageView {
     13  public:
     14   explicit StarView(CommandUpdater* command_updater);
     15   virtual ~StarView();
     16 
     17   // Toggles the star on or off.
     18   void SetToggled(bool on);
     19 
     20  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);
     41 };
     42 
     43 #endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_STAR_VIEW_H_
     44