Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: ash/system/logout_button/logout_button_tray.h

Issue 40053002: Implements the dialog view for logout button tray in public sessions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/time/time.h"
13 #include "ui/views/controls/button/button.h" 17 #include "ui/views/controls/button/button.h"
14 18
15 namespace views { 19 namespace views {
16 class LabelButton; 20 class LabelButton;
17 } 21 }
18 22
19 namespace ash { 23 namespace ash {
20 namespace internal { 24 namespace internal {
21 25
22 class StatusAreaWidget; 26 class StatusAreaWidget;
23 27
24 // Adds a logout button to the launcher's status area if enabled by the 28 // Adds a logout button to the launcher's status area if enabled by the
25 // kShowLogoutButtonInTray pref. 29 // kShowLogoutButtonInTray pref.
26 class LogoutButtonTray : public TrayBackgroundView, 30 class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView,
27 public LogoutButtonObserver, 31 public LogoutButtonObserver,
28 public views::ButtonListener { 32 public views::ButtonListener {
29 public: 33 public:
30 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget); 34 explicit LogoutButtonTray(StatusAreaWidget* status_area_widget);
31 virtual ~LogoutButtonTray(); 35 virtual ~LogoutButtonTray();
32 36
33 // TrayBackgroundView: 37 // TrayBackgroundView:
34 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; 38 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
35 virtual base::string16 GetAccessibleNameForTray() OVERRIDE; 39 virtual base::string16 GetAccessibleNameForTray() OVERRIDE;
36 virtual void HideBubbleWithView( 40 virtual void HideBubbleWithView(
37 const views::TrayBubbleView* bubble_view) OVERRIDE; 41 const views::TrayBubbleView* bubble_view) OVERRIDE;
38 virtual bool ClickedOutsideBubble() OVERRIDE; 42 virtual bool ClickedOutsideBubble() OVERRIDE;
39 43
40 // LogoutButtonObserver: 44 // LogoutButtonObserver:
41 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE; 45 virtual void OnShowLogoutButtonInTrayChanged(bool show) OVERRIDE;
46 virtual void OnLogoutDialogDurationChanged(base::TimeDelta duration) OVERRIDE;
42 47
43 // views::ButtonListener: 48 // views::ButtonListener:
44 virtual void ButtonPressed(views::Button* sender, 49 virtual void ButtonPressed(views::Button* sender,
45 const ui::Event& event) OVERRIDE; 50 const ui::Event& event) OVERRIDE;
46 51
47 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); 52 void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
48 53
54 // Nullify the pointer to confirmation dialog, this is expected to be called
55 // when the confirmation dialog is going to be destroyed.
56 // Note: the confirmation dialog is not owned by LogoutButtonTray.
57 void ReleaseConfirmationDialog();
58
59 void SetDelegateForTest(
60 scoped_ptr<LogoutConfirmationDialogView::Delegate> delegate);
61
49 private: 62 private:
63 friend class LogoutConfirmationDialogTest;
64
65 bool IsConfirmationDialogShowing() const;
66 void EnsureConfirmationDialogIsShowing();
67 void EnsureConfirmationDialogIsClosed();
68
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 LogoutConfirmationDialogView* confirmation_dialog_; // Not owned.
77 scoped_ptr<LogoutConfirmationDialogView::Delegate> confirmation_delegate_;
55 78
56 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray); 79 DISALLOW_COPY_AND_ASSIGN(LogoutButtonTray);
57 }; 80 };
58 81
59 } // namespace internal 82 } // namespace internal
60 } // namespace ash 83 } // namespace ash
61 84
62 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_ 85 #endif // ASH_SYSTEM_LOGOUT_BUTTON_LOGOUT_BUTTON_TRAY_H_
OLDNEW
« no previous file with comments | « ash/system/logout_button/logout_button_observer.h ('k') | ash/system/logout_button/logout_button_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698