Chromium Code Reviews| 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 CommandUpdater; | 10 class CommandUpdater; |
| 11 | 11 |
| 12 // Represents an icon on the omnibox that shows a bubble when clicked. | 12 // Represents an icon on the omnibox that shows a bubble when clicked. |
| 13 class BubbleIconView : public views::ImageView { | 13 class BubbleIconView : public views::ImageView { |
| 14 protected: | 14 protected: |
| 15 enum ExecuteSource { | 15 enum ExecuteSource { |
| 16 EXECUTE_SOURCE_MOUSE, | 16 EXECUTE_SOURCE_MOUSE, |
| 17 EXECUTE_SOURCE_KEYBOARD, | 17 EXECUTE_SOURCE_KEYBOARD, |
| 18 EXECUTE_SOURCE_GESTURE, | 18 EXECUTE_SOURCE_GESTURE, |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 BubbleIconView(); | |
|
msw
2014/10/24 00:00:55
Remove this, ZoomBubbleView can just pass BubbleIc
Dan Beam
2014/10/24 00:26:19
Done.
| |
| 21 explicit BubbleIconView(CommandUpdater* command_updater, int command_id); | 22 explicit BubbleIconView(CommandUpdater* command_updater, int command_id); |
| 22 virtual ~BubbleIconView(); | 23 virtual ~BubbleIconView(); |
|
msw
2014/10/24 00:00:55
optional nit: virtual -> override here and below.
Dan Beam
2014/10/24 00:26:19
Done.
| |
| 23 | 24 |
| 24 // Returns true if a related bubble is showing. | 25 // Returns true if a related bubble is showing. |
| 25 virtual bool IsBubbleShowing() const = 0; | 26 virtual bool IsBubbleShowing() const = 0; |
| 26 | 27 |
| 27 // Invoked prior to executing the command. | 28 // Invoked prior to executing the command. |
| 28 virtual void OnExecuting(ExecuteSource execute_source) = 0; | 29 virtual void OnExecuting(ExecuteSource execute_source) = 0; |
| 29 | 30 |
| 30 // views::ImageView: | 31 // views::ImageView: |
| 31 virtual void GetAccessibleState(ui::AXViewState* state) override; | 32 virtual void GetAccessibleState(ui::AXViewState* state) override; |
| 32 virtual bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) | 33 virtual bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) |
| 33 const override; | 34 const override; |
| 34 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 35 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
| 35 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 36 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
| 36 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 37 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 37 | 38 |
| 38 // ui::EventHandler: | 39 // ui::EventHandler: |
| 39 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 40 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
| 40 | 41 |
| 41 private: | 42 private: |
| 43 // Executes the given |command_id_| with |command_updater_| if specified when | |
|
msw
2014/10/24 00:00:55
optional nit: one-liner "// Calls OnExecuting and
Dan Beam
2014/10/24 00:26:19
Done.
| |
| 44 // constructed. | |
| 45 void ExecuteCommand(); | |
| 46 | |
| 42 // The CommandUpdater for the Browser object that owns the location bar. | 47 // The CommandUpdater for the Browser object that owns the location bar. |
| 43 CommandUpdater* command_updater_; | 48 CommandUpdater* command_updater_; |
| 44 | 49 |
| 45 // The command ID executed when the user clicks this icon. | 50 // The command ID executed when the user clicks this icon. |
| 46 const int command_id_; | 51 const int command_id_; |
| 47 | 52 |
| 48 // This is used to check if the bookmark bubble was showing during the mouse | 53 // This is used to check if the bookmark bubble was showing during the mouse |
| 49 // pressed event. If this is true then the mouse released event is ignored to | 54 // pressed event. If this is true then the mouse released event is ignored to |
| 50 // prevent the bubble from reshowing. | 55 // prevent the bubble from reshowing. |
| 51 bool suppress_mouse_released_action_; | 56 bool suppress_mouse_released_action_; |
| 52 | 57 |
| 53 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); | 58 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); |
| 54 }; | 59 }; |
| 55 | 60 |
| 56 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 61 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
| OLD | NEW |