cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / browser / ui / views / location_bar / bubble_icon_view.h
blob94e61438a22cf2f4989489add34d24483c0b810f
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"
10 class CommandUpdater;
12 namespace views {
13 class BubbleDelegateView;
16 // Represents an icon on the omnibox that shows a bubble when clicked.
17 class BubbleIconView : public views::ImageView {
18 protected:
19 enum ExecuteSource {
20 EXECUTE_SOURCE_MOUSE,
21 EXECUTE_SOURCE_KEYBOARD,
22 EXECUTE_SOURCE_GESTURE,
25 BubbleIconView(CommandUpdater* command_updater, int command_id);
26 ~BubbleIconView() override;
28 // Returns true if a related bubble is showing.
29 bool IsBubbleShowing() const;
31 // Invoked prior to executing the command.
32 virtual void OnExecuting(ExecuteSource execute_source) = 0;
34 // views::ImageView:
35 void GetAccessibleState(ui::AXViewState* state) override;
36 bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) const
37 override;
38 bool OnMousePressed(const ui::MouseEvent& event) override;
39 void OnMouseReleased(const ui::MouseEvent& event) override;
40 bool OnKeyPressed(const ui::KeyEvent& event) override;
42 // ui::EventHandler:
43 void OnGestureEvent(ui::GestureEvent* event) override;
45 protected:
46 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|.
47 virtual void ExecuteCommand(ExecuteSource source);
49 // Returns the bubble instance for the icon.
50 virtual views::BubbleDelegateView* GetBubble() const = 0;
52 // views::View:
53 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
55 private:
56 // The CommandUpdater for the Browser object that owns the location bar.
57 CommandUpdater* command_updater_;
59 // The command ID executed when the user clicks this icon.
60 const int command_id_;
62 // This is used to check if the bookmark bubble was showing during the mouse
63 // pressed event. If this is true then the mouse released event is ignored to
64 // prevent the bubble from reshowing.
65 bool suppress_mouse_released_action_;
67 DISALLOW_COPY_AND_ASSIGN(BubbleIconView);
70 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_