| 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 ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void OnPaintFocus(gfx::Canvas* canvas); | 45 void OnPaintFocus(gfx::Canvas* canvas); |
| 46 | 46 |
| 47 // Returns the bounds to paint the focus rectangle in. | 47 // Returns the bounds to paint the focus rectangle in. |
| 48 virtual gfx::Rect GetFocusBounds(); | 48 virtual gfx::Rect GetFocusBounds(); |
| 49 | 49 |
| 50 // Performs an action when user clicks on the view (on mouse-press event), or | 50 // Performs an action when user clicks on the view (on mouse-press event), or |
| 51 // presses a key when this view is in focus. Returns true if the event has | 51 // presses a key when this view is in focus. Returns true if the event has |
| 52 // been handled and an action was performed. Returns false otherwise. | 52 // been handled and an action was performed. Returns false otherwise. |
| 53 virtual bool PerformAction(const ui::Event& event) = 0; | 53 virtual bool PerformAction(const ui::Event& event) = 0; |
| 54 | 54 |
| 55 // Called after PerformAction() to act upon its result, including showing |
| 56 // appropriate ink drop ripple. This will not get called if the view is |
| 57 // destroyed during PerformAction(). Default implementation shows triggered |
| 58 // ripple if action is performed or hides existing ripple if no action is |
| 59 // performed. Subclasses can override to change the default behavior. |
| 60 virtual void HandlePerformActionResult(bool action_performed, |
| 61 const ui::Event& event); |
| 62 |
| 55 // Overridden from views::CustomButton. | 63 // Overridden from views::CustomButton. |
| 56 const char* GetClassName() const override; | 64 const char* GetClassName() const override; |
| 57 bool OnKeyPressed(const ui::KeyEvent& event) override; | 65 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 58 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 66 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 59 void OnPaint(gfx::Canvas* canvas) override; | 67 void OnPaint(gfx::Canvas* canvas) override; |
| 60 void OnFocus() override; | 68 void OnFocus() override; |
| 61 void OnBlur() override; | 69 void OnBlur() override; |
| 62 std::unique_ptr<views::InkDrop> CreateInkDrop() override; | 70 std::unique_ptr<views::InkDrop> CreateInkDrop() override; |
| 63 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 71 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 64 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 72 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| (...skipping 27 matching lines...) Expand all Loading... |
| 92 | 100 |
| 93 private: | 101 private: |
| 94 views::ButtonListener* listener_; | 102 views::ButtonListener* listener_; |
| 95 | 103 |
| 96 DISALLOW_COPY_AND_ASSIGN(ButtonListenerActionableView); | 104 DISALLOW_COPY_AND_ASSIGN(ButtonListenerActionableView); |
| 97 }; | 105 }; |
| 98 | 106 |
| 99 } // namespace ash | 107 } // namespace ash |
| 100 | 108 |
| 101 #endif // ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ | 109 #endif // ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ |
| OLD | NEW |