| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TILES_TILES_DEFAULT_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/common/login_status.h" |
| 8 #include "ash/common/system/chromeos/shutdown_policy_observer.h" | 9 #include "ash/common/system/chromeos/shutdown_policy_observer.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 11 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 13 | 14 |
| 15 namespace views { |
| 16 class CustomButton; |
| 17 } |
| 18 |
| 14 namespace ash { | 19 namespace ash { |
| 20 class SystemMenuButton; |
| 15 class SystemTrayItem; | 21 class SystemTrayItem; |
| 16 | 22 |
| 17 // The container view for the tiles in the bottom row of the system menu | 23 // The container view for the tiles in the bottom row of the system menu |
| 18 // (settings, help, lock, and power). | 24 // (settings, help, lock, and power). |
| 19 class TilesDefaultView : public views::View, | 25 class TilesDefaultView : public views::View, |
| 20 public views::ButtonListener, | 26 public views::ButtonListener, |
| 21 public ShutdownPolicyObserver { | 27 public ShutdownPolicyObserver { |
| 22 public: | 28 public: |
| 23 explicit TilesDefaultView(SystemTrayItem* owner); | 29 TilesDefaultView(SystemTrayItem* owner, LoginStatus login); |
| 24 ~TilesDefaultView() override; | 30 ~TilesDefaultView() override; |
| 25 | 31 |
| 26 // Sets the layout manager and child views of |this|. | 32 // Sets the layout manager and child views of |this|. |
| 27 // TODO(tdanderson|bruthig): Consider moving the layout manager | 33 // TODO(tdanderson|bruthig): Consider moving the layout manager |
| 28 // setup code to a location which can be shared by other system menu rows. | 34 // setup code to a location which can be shared by other system menu rows. |
| 29 void Init(); | 35 void Init(); |
| 30 | 36 |
| 31 // views::ButtonListener: | 37 // views::ButtonListener: |
| 32 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 38 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 33 | 39 |
| 34 // ShutdownPolicyObserver: | 40 // ShutdownPolicyObserver: |
| 35 void OnShutdownPolicyChanged(bool reboot_on_shutdown) override; | 41 void OnShutdownPolicyChanged(bool reboot_on_shutdown) override; |
| 36 | 42 |
| 37 private: | 43 private: |
| 44 friend class TrayTilesTest; |
| 45 |
| 38 // Helper function to add a separator line between two tiles. | 46 // Helper function to add a separator line between two tiles. |
| 39 // TODO(tdanderson|bruthig): Consider moving this to a location which can be | 47 // TODO(tdanderson|bruthig): Consider moving this to a location which can be |
| 40 // shared by other system menu rows. | 48 // shared by other system menu rows. |
| 41 void AddSeparator(); | 49 void AddSeparator(); |
| 42 | 50 |
| 43 SystemTrayItem* owner_; | 51 SystemTrayItem* owner_; |
| 44 | 52 |
| 53 LoginStatus login_; |
| 54 |
| 45 // Pointers to the child buttons of |this|. Note that some buttons may not | 55 // Pointers to the child buttons of |this|. Note that some buttons may not |
| 46 // exist (depending on the user's current login status, for instance), in | 56 // exist (depending on the user's current login status, for instance), in |
| 47 // which case the corresponding pointer will be null. | 57 // which case the corresponding pointer will be null. |
| 48 views::Button* settings_button_; | 58 views::CustomButton* settings_button_; |
| 49 views::Button* help_button_; | 59 views::CustomButton* help_button_; |
| 50 views::Button* lock_button_; | 60 views::CustomButton* lock_button_; |
| 51 views::Button* power_button_; | 61 views::CustomButton* power_button_; |
| 52 | 62 |
| 53 base::WeakPtrFactory<TilesDefaultView> weak_factory_; | 63 base::WeakPtrFactory<TilesDefaultView> weak_factory_; |
| 54 | 64 |
| 55 DISALLOW_COPY_AND_ASSIGN(TilesDefaultView); | 65 DISALLOW_COPY_AND_ASSIGN(TilesDefaultView); |
| 56 }; | 66 }; |
| 57 | 67 |
| 58 } // namespace ash | 68 } // namespace ash |
| 59 | 69 |
| 60 #endif // ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ | 70 #endif // ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ |
| OLD | NEW |