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