| 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/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" |
| 10 #include "ash/common/system/chromeos/shutdown_policy_observer.h" | |
| 11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 15 | 13 |
| 16 namespace views { | 14 namespace views { |
| 17 class CustomButton; | 15 class CustomButton; |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace ash { | 18 namespace ash { |
| 21 class SystemMenuButton; | 19 class SystemMenuButton; |
| 22 class SystemTrayItem; | 20 class SystemTrayItem; |
| 23 | 21 |
| 24 // The container view for the tiles in the bottom row of the system menu | 22 // The container view for the tiles in the bottom row of the system menu |
| 25 // (settings, help, lock, and power). | 23 // (settings, help, lock, and power). |
| 26 class ASH_EXPORT TilesDefaultView : public views::View, | 24 class ASH_EXPORT TilesDefaultView : public views::View, |
| 27 public views::ButtonListener, | 25 public views::ButtonListener { |
| 28 public ShutdownPolicyObserver { | |
| 29 public: | 26 public: |
| 30 TilesDefaultView(SystemTrayItem* owner, LoginStatus login); | 27 TilesDefaultView(SystemTrayItem* owner, LoginStatus login); |
| 31 ~TilesDefaultView() override; | 28 ~TilesDefaultView() override; |
| 32 | 29 |
| 33 // Sets the layout manager and child views of |this|. | 30 // Sets the layout manager and child views of |this|. |
| 34 // TODO(tdanderson|bruthig): Consider moving the layout manager | 31 // TODO(tdanderson|bruthig): Consider moving the layout manager |
| 35 // setup code to a location which can be shared by other system menu rows. | 32 // setup code to a location which can be shared by other system menu rows. |
| 36 void Init(); | 33 void Init(); |
| 37 | 34 |
| 38 // views::ButtonListener: | 35 // views::ButtonListener: |
| 39 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 36 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 40 | 37 |
| 41 // ShutdownPolicyObserver: | |
| 42 void OnShutdownPolicyChanged(bool reboot_on_shutdown) override; | |
| 43 | |
| 44 // Accessor needed to obtain the help button view for the first-run flow. | 38 // Accessor needed to obtain the help button view for the first-run flow. |
| 45 views::View* GetHelpButtonView() const; | 39 views::View* GetHelpButtonView() const; |
| 46 | 40 |
| 47 const views::CustomButton* GetShutdownButtonViewForTest() const; | 41 const views::CustomButton* GetShutdownButtonViewForTest() const; |
| 48 | 42 |
| 49 private: | 43 private: |
| 50 friend class TrayTilesTest; | 44 friend class TrayTilesTest; |
| 51 | 45 |
| 52 SystemTrayItem* owner_; | 46 SystemTrayItem* owner_; |
| 53 LoginStatus login_; | 47 LoginStatus login_; |
| 54 | 48 |
| 55 // 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 |
| 56 // 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 |
| 57 // which case the corresponding pointer will be null. | 51 // which case the corresponding pointer will be null. |
| 58 views::CustomButton* settings_button_; | 52 views::CustomButton* settings_button_; |
| 59 views::CustomButton* help_button_; | 53 views::CustomButton* help_button_; |
| 60 views::CustomButton* lock_button_; | 54 views::CustomButton* lock_button_; |
| 61 views::CustomButton* power_button_; | 55 views::CustomButton* power_button_; |
| 62 | 56 |
| 63 base::WeakPtrFactory<TilesDefaultView> weak_factory_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(TilesDefaultView); | 57 DISALLOW_COPY_AND_ASSIGN(TilesDefaultView); |
| 66 }; | 58 }; |
| 67 | 59 |
| 68 } // namespace ash | 60 } // namespace ash |
| 69 | 61 |
| 70 #endif // ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ | 62 #endif // ASH_COMMON_SYSTEM_TILES_TILES_DEFAULT_VIEW_H_ |
| OLD | NEW |