Chromium Code Reviews| 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_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 5 #ifndef ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
| 6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 6 #define ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | |
| 8 #include "ash/system/logout_button/logout_button_observer.h" | 9 #include "ash/system/logout_button/logout_button_observer.h" |
| 10 #include "ash/system/logout_button/logout_confirmation_dialog_view.h" | |
| 9 #include "ash/system/tray/tray_background_view.h" | 11 #include "ash/system/tray/tray_background_view.h" |
| 10 #include "ash/system/user/login_status.h" | 12 #include "ash/system/user/login_status.h" |
| 11 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | |
| 17 #include "base/time/time.h" | |
| 13 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
| 14 | 19 |
| 15 namespace views { | 20 namespace views { |
| 16 class LabelButton; | 21 class LabelButton; |
| 17 } | 22 } |
| 18 | 23 |
| 19 namespace ash { | 24 namespace ash { |
| 20 namespace internal { | 25 namespace internal { |
| 21 | 26 |
| 22 class StatusAreaWidget; | 27 class StatusAreaWidget; |
| 28 class LogoutConfirmationDialogTest; | |
|
bartfab (slow)
2013/12/10 12:41:16
Nit: This is not needed. Stating that LogoutConfir
binjin
2013/12/12 13:56:55
Done.
| |
| 23 | 29 |
| 24 // Adds a logout button to the launcher's status area if enabled by the | 30 // Adds a logout button to the launcher's status area if enabled by the |
| 25 // kShowLogoutButtonInTray pref. | 31 // kShowLogoutButtonInTray pref. |
| 26 class LogoutButtonTray : public TrayBackgroundView, | 32 class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView, |
| 27 public LogoutButtonObserver, | 33 public LogoutButtonObserver, |
| 28 public views::ButtonListener { | 34 public views::ButtonListener { |
| 29 public: | 35 public: |
| 30 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); | 36 friend class LogoutConfirmationDialogTest; |
|
bartfab (slow)
2013/12/10 12:41:16
Nit: The friend declaration should go to the start
binjin
2013/12/12 13:56:55
Done.
| |
| 37 LogoutButtonTray(StatusAreaWidget* status_area_widget, | |
|
bartfab (slow)
2013/12/10 12:41:16
Nit: Indentation: All arguments must be aligned. I
binjin
2013/12/12 13:56:55
Done.
| |
| 38 LogoutConfirmationDialogView::LogoutConfirmationDelegate* delegate); | |
|
bartfab (slow)
2013/12/10 12:41:16
1) You are passing ownership of |delegate| here. U
binjin
2013/12/12 13:56:55
Done.
| |
| 31 virtual ~LogoutButtonTray(); | 39 virtual ~LogoutButtonTray(); |
| 32 | 40 |
| 41 void EnsureConfirmationDialogIsShowing(); | |
| 42 void EnsureConfirmationDialogIsClosed(); | |
| 43 bool IsConfirmationDialogShowing(); | |
|
bartfab (slow)
2013/12/10 12:41:16
Nit 1: Getters usually go before setters. Thus, Is
binjin
2013/12/12 13:56:55
Done.
| |
| 44 | |
| 33 // TrayBackgroundView: | 45 // TrayBackgroundView: |
| 34 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; | 46 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
| 35 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; | 47 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; |
| 36 virtual void HideBubbleWithView( | 48 virtual void HideBubbleWithView( |
| 37 const views::TrayBubbleView* bubble_view) OVERRIDE; | 49 const views::TrayBubbleView* bubble_view) OVERRIDE; |
| 38 virtual bool ClickedOutsideBubble() OVERRIDE; | 50 virtual bool ClickedOutsideBubble() OVERRIDE; |
| 39 | 51 |
| 40 // LogoutButtonObserver: | 52 // LogoutButtonObserver: |
| 41 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; | 53 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; |
| 54 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration) OVERRIDE; | |
| 42 | 55 |
| 43 // views::ButtonListener: | 56 // views::ButtonListener: |
| 44 virtual void ButtonPressed(views::Button* sender, | 57 virtual void ButtonPressed(views::Button* sender, |
| 45 const ui::Event& event) OVERRIDE; | 58 const ui::Event& event) OVERRIDE; |
| 46 | 59 |
| 47 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 60 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
| 48 | 61 |
| 62 void DeleteConfirmationDialog(); | |
| 63 | |
| 64 LogoutConfirmationDialogView* GetConfirmationDialogForTest(); | |
| 65 LogoutConfirmationDialogView::LogoutConfirmationDelegate* | |
| 66 GetConfirmationDelegateForTest(); | |
| 67 | |
| 49 private: | 68 private: |
| 50 void UpdateVisibility(); | 69 void UpdateVisibility(); |
| 51 | 70 |
| 52 views::LabelButton* button_; // Not owned. | 71 views::LabelButton* button_; // Not owned. |
| 53 user::LoginStatus login_status_; | 72 user::LoginStatus login_status_; |
| 54 bool show_logout_button_in_tray_; | 73 bool show_logout_button_in_tray_; |
| 74 base::TimeDelta dialog_duration_; | |
| 75 | |
| 76 scoped_ptr<LogoutConfirmationDialogView> confirmation_dialog_; | |
| 77 scoped_ptr<LogoutConfirmationDialogView::LogoutConfirmationDelegate> | |
| 78 confirmation_delegate_; | |
| 79 base::WeakPtrFactory<LogoutButtonTray> weak_factory_; | |
| 55 | 80 |
| 56 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); | 81 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); |
| 57 }; | 82 }; |
| 58 | 83 |
| 59 } // namespace internal | 84 } // namespace internal |
| 60 } // namespace ash | 85 } // namespace ash |
| 61 | 86 |
| 62 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ | 87 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ |
| OLD | NEW |