| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| 11 #include "ui/gfx/vector_icons_public.h" | 11 #include "ui/gfx/vector_icons_public.h" |
| 12 #include "ui/views/animation/ink_drop_host_view.h" | 12 #include "ui/views/animation/ink_drop_host_view.h" |
| 13 #include "ui/views/controls/image_view.h" | 13 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/widget/widget_observer.h" | 14 #include "ui/views/widget/widget_observer.h" |
| 15 | 15 |
| 16 class CommandUpdater; | 16 class CommandUpdater; |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 enum class VectorIconId; | 19 enum class VectorIconId; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 class BubbleDelegateView; | 23 class BubbleDialogDelegateView; |
| 24 class InkDropDelegate; | 24 class InkDropDelegate; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Represents an icon on the omnibox that shows a bubble when clicked. | 27 // Represents an icon on the omnibox that shows a bubble when clicked. |
| 28 class BubbleIconView : public views::InkDropHostView, | 28 class BubbleIconView : public views::InkDropHostView, |
| 29 public views::WidgetObserver { | 29 public views::WidgetObserver { |
| 30 protected: | 30 protected: |
| 31 enum ExecuteSource { | 31 enum ExecuteSource { |
| 32 EXECUTE_SOURCE_MOUSE, | 32 EXECUTE_SOURCE_MOUSE, |
| 33 EXECUTE_SOURCE_KEYBOARD, | 33 EXECUTE_SOURCE_KEYBOARD, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // views::WidgetObserver: | 76 // views::WidgetObserver: |
| 77 void OnWidgetDestroying(views::Widget* widget) override; | 77 void OnWidgetDestroying(views::Widget* widget) override; |
| 78 void OnWidgetVisibilityChanged(views::Widget* widget, | 78 void OnWidgetVisibilityChanged(views::Widget* widget, |
| 79 bool visible) override; | 79 bool visible) override; |
| 80 | 80 |
| 81 protected: | 81 protected: |
| 82 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. | 82 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. |
| 83 virtual void ExecuteCommand(ExecuteSource source); | 83 virtual void ExecuteCommand(ExecuteSource source); |
| 84 | 84 |
| 85 // Returns the bubble instance for the icon. | 85 // Returns the bubble instance for the icon. |
| 86 virtual views::BubbleDelegateView* GetBubble() const = 0; | 86 virtual views::BubbleDialogDelegateView* GetBubble() const = 0; |
| 87 | 87 |
| 88 // Gets the given vector icon in the correct color and size based on |active| | 88 // Gets the given vector icon in the correct color and size based on |active| |
| 89 // and whether Chrome's in material design mode. | 89 // and whether Chrome's in material design mode. |
| 90 virtual gfx::VectorIconId GetVectorIcon() const; | 90 virtual gfx::VectorIconId GetVectorIcon() const; |
| 91 | 91 |
| 92 // Sets the image using a PNG from the resource bundle. Returns true if an | 92 // Sets the image using a PNG from the resource bundle. Returns true if an |
| 93 // image was set, or false if the icon should use a vector asset. This only | 93 // image was set, or false if the icon should use a vector asset. This only |
| 94 // exists for non-MD mode. TODO(estade): remove it. | 94 // exists for non-MD mode. TODO(estade): remove it. |
| 95 virtual bool SetRasterIcon(); | 95 virtual bool SetRasterIcon(); |
| 96 | 96 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 126 // prevent the bubble from reshowing. | 126 // prevent the bubble from reshowing. |
| 127 bool suppress_mouse_released_action_; | 127 bool suppress_mouse_released_action_; |
| 128 | 128 |
| 129 // Animation delegate for the ink drop ripple effect. | 129 // Animation delegate for the ink drop ripple effect. |
| 130 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; | 130 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); | 132 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
| OLD | NEW |