| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Returns the image currently displayed, which can be empty if not set. | 47 // Returns the image currently displayed, which can be empty if not set. |
| 48 // The returned image is owned by |image_|. | 48 // The returned image is owned by |image_|. |
| 49 const gfx::ImageSkia& GetImage() const; | 49 const gfx::ImageSkia& GetImage() const; |
| 50 | 50 |
| 51 // Sets the tooltip text. | 51 // Sets the tooltip text. |
| 52 void SetTooltipText(const base::string16& tooltip); | 52 void SetTooltipText(const base::string16& tooltip); |
| 53 | 53 |
| 54 // Invoked prior to executing the command. | 54 // Invoked prior to executing the command. |
| 55 virtual void OnExecuting(ExecuteSource execute_source) = 0; | 55 virtual void OnExecuting(ExecuteSource execute_source) = 0; |
| 56 | 56 |
| 57 // Invoked after the icon is pressed. |
| 58 virtual void OnPressed(bool activated) {} |
| 59 |
| 57 // views::View: | 60 // views::View: |
| 58 void GetAccessibleState(ui::AXViewState* state) override; | 61 void GetAccessibleState(ui::AXViewState* state) override; |
| 59 bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) const | 62 bool GetTooltipText(const gfx::Point& p, |
| 60 override; | 63 base::string16* tooltip) const override; |
| 61 gfx::Size GetPreferredSize() const override; | 64 gfx::Size GetPreferredSize() const override; |
| 62 void Layout() override; | 65 void Layout() override; |
| 63 bool OnMousePressed(const ui::MouseEvent& event) override; | 66 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 64 void OnMouseReleased(const ui::MouseEvent& event) override; | 67 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 65 bool OnKeyPressed(const ui::KeyEvent& event) override; | 68 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 66 bool OnKeyReleased(const ui::KeyEvent& event) override; | 69 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 67 void ViewHierarchyChanged( | 70 void ViewHierarchyChanged( |
| 68 const ViewHierarchyChangedDetails& details) override; | 71 const ViewHierarchyChangedDetails& details) override; |
| 69 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 72 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 70 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 73 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 71 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 74 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 72 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override; | 75 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override; |
| 73 SkColor GetInkDropBaseColor() const override; | 76 SkColor GetInkDropBaseColor() const override; |
| 74 | 77 |
| 75 // ui::EventHandler: | 78 // ui::EventHandler: |
| 76 void OnGestureEvent(ui::GestureEvent* event) override; | 79 void OnGestureEvent(ui::GestureEvent* event) override; |
| 77 | 80 |
| 78 // views::WidgetObserver: | 81 // views::WidgetObserver: |
| 79 void OnWidgetDestroying(views::Widget* widget) override; | 82 void OnWidgetDestroying(views::Widget* widget) override; |
| 80 void OnWidgetVisibilityChanged(views::Widget* widget, | 83 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
| 81 bool visible) override; | |
| 82 | 84 |
| 83 protected: | 85 protected: |
| 84 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. | 86 // Calls OnExecuting and runs |command_id_| with a valid |command_updater_|. |
| 85 virtual void ExecuteCommand(ExecuteSource source); | 87 virtual void ExecuteCommand(ExecuteSource source); |
| 86 | 88 |
| 87 // Returns the bubble instance for the icon. | 89 // Returns the bubble instance for the icon. |
| 88 virtual views::BubbleDialogDelegateView* GetBubble() const = 0; | 90 virtual views::BubbleDialogDelegateView* GetBubble() const = 0; |
| 89 | 91 |
| 90 // Gets the given vector icon in the correct color and size based on |active| | 92 // Gets the given vector icon in the correct color and size based on |active| |
| 91 // and whether Chrome's in material design mode. | 93 // and whether Chrome's in material design mode. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // prevent the bubble from reshowing. | 130 // prevent the bubble from reshowing. |
| 129 bool suppress_mouse_released_action_; | 131 bool suppress_mouse_released_action_; |
| 130 | 132 |
| 131 // Animation delegate for the ink drop ripple effect. | 133 // Animation delegate for the ink drop ripple effect. |
| 132 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; | 134 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; |
| 133 | 135 |
| 134 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); | 136 DISALLOW_COPY_AND_ASSIGN(BubbleIconView); |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ | 139 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
| OLD | NEW |