OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
7 | 7 |
8 #include "ui/views/controls/image_view.h" | 8 #include "ui/views/controls/image_view.h" |
9 | 9 |
10 class Browser; | |
10 class CommandUpdater; | 11 class CommandUpdater; |
11 | 12 |
12 // Represents an icon on the omnibox that shows a bubble when clicked. | 13 // Represents an icon on the omnibox that shows a bubble when clicked. |
13 class BubbleIconView : public views::ImageView { | 14 class BubbleIconView : public views::ImageView { |
14 protected: | 15 protected: |
15 enum ExecuteSource { | 16 enum ExecuteSource { |
16 EXECUTE_SOURCE_MOUSE, | 17 EXECUTE_SOURCE_MOUSE, |
17 EXECUTE_SOURCE_KEYBOARD, | 18 EXECUTE_SOURCE_KEYBOARD, |
18 EXECUTE_SOURCE_GESTURE, | 19 EXECUTE_SOURCE_GESTURE, |
19 }; | 20 }; |
20 | 21 |
21 explicit BubbleIconView(CommandUpdater* command_updater, int command_id); | 22 explicit BubbleIconView(CommandUpdater* command_updater, |
23 int command_id, | |
24 Browser* browser); | |
Peter Kasting
2014/12/12 01:20:57
Nit: While here: This shouldn't be explicit as it'
Deepak
2014/12/12 06:49:47
Done.
| |
22 ~BubbleIconView() override; | 25 ~BubbleIconView() override; |
23 | 26 |
24 // Returns true if a related bubble is showing. | 27 // Returns true if a related bubble is showing. |
25 virtual bool IsBubbleShowing() const = 0; | 28 virtual bool IsBubbleShowing() const = 0; |
26 | 29 |
27 // Invoked prior to executing the command. | 30 // Invoked prior to executing the command. |
28 virtual void OnExecuting(ExecuteSource execute_source) = 0; | 31 virtual void OnExecuting(ExecuteSource execute_source) = 0; |
29 | 32 |
30 // views::ImageView: | 33 // views::ImageView: |
31 void GetAccessibleState(ui::AXViewState* state) override; | 34 void GetAccessibleState(ui::AXViewState* state) override; |
32 bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) const | 35 bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) const |
33 override; | 36 override; |
34 bool OnMousePressed(const ui::MouseEvent& event) override; | 37 bool OnMousePressed(const ui::MouseEvent& event) override; |
35 void OnMouseReleased(const ui::MouseEvent& event) override; | 38 void OnMouseReleased(const ui::MouseEvent& event) override; |
36 bool OnKeyPressed(const ui::KeyEvent& event) override; | 39 bool OnKeyPressed(const ui::KeyEvent& event) override; |
37 | 40 |
38 // ui::EventHandler: | 41 // ui::EventHandler: |
39 void OnGestureEvent(ui::GestureEvent* event) override; | 42 void OnGestureEvent(ui::GestureEvent* event) override; |
40 | 43 |
41 private: | 44 private: |
42 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. | 45 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. |
43 void ExecuteCommand(ExecuteSource source); | 46 void ExecuteCommand(ExecuteSource source); |
44 | 47 |
45 // The CommandUpdater for the Browser object that owns the location bar. | 48 // The CommandUpdater for the Browser object that owns the location bar. |
46 CommandUpdater* command_updater_; | 49 CommandUpdater* command_updater_; |
47 | 50 |
48 // The command ID executed when the user clicks this icon. | 51 // The command ID executed when the user clicks this icon. |
49 const int command_id_; | 52 const int command_id_; |
50 | 53 |
54 // The Browser for bookmarking by selecting star icon. | |
55 Browser* browser_; | |
56 | |
51 // This is used to check if the bookmark bubble was showing during the mouse | 57 // This is used to check if the bookmark bubble was showing during the mouse |
52 // pressed event. If this is true then the mouse released event is ignored to | 58 // pressed event. If this is true then the mouse released event is ignored to |
53 // prevent the bubble from reshowing. | 59 // prevent the bubble from reshowing. |
54 bool suppress_mouse_released_action_; | 60 bool suppress_mouse_released_action_; |
55 | 61 |
56 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); | 62 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); |
57 }; | 63 }; |
58 | 64 |
59 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
OLD | NEW |