1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_
8 #include "ui/views/controls/image_view.h"
12 // Represents an icon on the omnibox that shows a bubble when clicked.
13 class BubbleIconView
: public views::ImageView
{
17 EXECUTE_SOURCE_KEYBOARD
,
18 EXECUTE_SOURCE_GESTURE
,
21 BubbleIconView(CommandUpdater
* command_updater
, int command_id
);
22 ~BubbleIconView() override
;
24 // Returns true if a related bubble is showing.
25 virtual bool IsBubbleShowing() const = 0;
27 // Invoked prior to executing the command.
28 virtual void OnExecuting(ExecuteSource execute_source
) = 0;
31 void GetAccessibleState(ui::AXViewState
* state
) override
;
32 bool GetTooltipText(const gfx::Point
& p
, base::string16
* tooltip
) const
34 bool OnMousePressed(const ui::MouseEvent
& event
) override
;
35 void OnMouseReleased(const ui::MouseEvent
& event
) override
;
36 bool OnKeyPressed(const ui::KeyEvent
& event
) override
;
39 void OnGestureEvent(ui::GestureEvent
* event
) override
;
42 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|.
43 virtual void ExecuteCommand(ExecuteSource source
);
46 // The CommandUpdater for the Browser object that owns the location bar.
47 CommandUpdater
* command_updater_
;
49 // The command ID executed when the user clicks this icon.
50 const int command_id_
;
52 // This is used to check if the bookmark bubble was showing during the mouse
53 // pressed event. If this is true then the mouse released event is ignored to
54 // prevent the bubble from reshowing.
55 bool suppress_mouse_released_action_
;
57 DISALLOW_COPY_AND_ASSIGN(BubbleIconView
);
60 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_