| 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/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
| 11 | 12 |
| 12 namespace ash { | 13 namespace ash { |
| 13 class SystemTrayItem; | 14 class SystemTrayItem; |
| 14 | 15 |
| 15 // A focusable view that performs an action when user clicks on it, or presses | 16 // A focusable view that performs an action when user clicks on it, or presses |
| 16 // enter or space when focused. Note that the action is triggered on mouse-up, | 17 // enter or space when focused. Note that the action is triggered on mouse-up, |
| 17 // instead of on mouse-down. So if user presses the mouse on the view, then | 18 // instead of on mouse-down. So if user presses the mouse on the view, then |
| 18 // moves the mouse out of the view and then releases, then the action will not | 19 // moves the mouse out of the view and then releases, then the action will not |
| 19 // be performed. | 20 // be performed. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // been handled and an action was performed. Returns false otherwise. | 52 // been handled and an action was performed. Returns false otherwise. |
| 52 virtual bool PerformAction(const ui::Event& event) = 0; | 53 virtual bool PerformAction(const ui::Event& event) = 0; |
| 53 | 54 |
| 54 // Overridden from views::CustomButton. | 55 // Overridden from views::CustomButton. |
| 55 const char* GetClassName() const override; | 56 const char* GetClassName() const override; |
| 56 bool OnKeyPressed(const ui::KeyEvent& event) override; | 57 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 57 void GetAccessibleState(ui::AXViewState* state) override; | 58 void GetAccessibleState(ui::AXViewState* state) override; |
| 58 void OnPaint(gfx::Canvas* canvas) override; | 59 void OnPaint(gfx::Canvas* canvas) override; |
| 59 void OnFocus() override; | 60 void OnFocus() override; |
| 60 void OnBlur() override; | 61 void OnBlur() override; |
| 62 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 63 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 64 const override; |
| 61 | 65 |
| 62 // Overridden from views::ButtonListener. | 66 // Overridden from views::ButtonListener. |
| 63 void ButtonPressed(Button* sender, const ui::Event& event) override; | 67 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 // Used by ButtonPressed() to determine whether |this| has been destroyed as a | 70 // Used by ButtonPressed() to determine whether |this| has been destroyed as a |
| 67 // result of performing the associated action. This is necessary because in | 71 // result of performing the associated action. This is necessary because in |
| 68 // the not-destroyed case ButtonPressed() uses member variables. | 72 // the not-destroyed case ButtonPressed() uses member variables. |
| 69 bool* destroyed_; | 73 bool* destroyed_; |
| 70 | 74 |
| 71 SystemTrayItem* owner_; | 75 SystemTrayItem* owner_; |
| 72 | 76 |
| 73 base::string16 accessible_name_; | 77 base::string16 accessible_name_; |
| 74 | 78 |
| 75 DISALLOW_COPY_AND_ASSIGN(ActionableView); | 79 DISALLOW_COPY_AND_ASSIGN(ActionableView); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace ash | 82 } // namespace ash |
| 79 | 83 |
| 80 #endif // ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ | 84 #endif // ASH_COMMON_SYSTEM_TRAY_ACTIONABLE_VIEW_H_ |
| OLD | NEW |