OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ash/system/chromeos/managed/tray_locally_managed_user.h" | 5 #include "ash/system/chromeos/managed/tray_locally_managed_user.h" |
6 | 6 |
7 #include "ash/system/chromeos/label_tray_view.h" | 7 #include "ash/system/chromeos/label_tray_view.h" |
8 #include "ash/system/tray/system_tray_notifier.h" | 8 #include "ash/system/tray/system_tray_notifier.h" |
9 #include "ash/system/tray/tray_notification_view.h" | 9 #include "ash/system/tray/tray_notification_view.h" |
10 #include "ash/system/user/login_status.h" | 10 #include "ash/system/user/login_status.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 InitView(message_view_); | 25 InitView(message_view_); |
26 } | 26 } |
27 | 27 |
28 void Update() { | 28 void Update() { |
29 CreateMessageView(); | 29 CreateMessageView(); |
30 UpdateView(message_view_); | 30 UpdateView(message_view_); |
31 } | 31 } |
32 | 32 |
33 private: | 33 private: |
34 void CreateMessageView() { | 34 void CreateMessageView() { |
35 // TODO(antrim): replace to appropriate icon when there is one. | |
36 message_view_ = new LabelTrayView(tray_managed_, | 35 message_view_ = new LabelTrayView(tray_managed_, |
37 IDR_AURA_UBER_TRAY_ENTERPRISE_DARK); | 36 IDR_AURA_UBER_TRAY_MANAGED_USER); |
38 base::string16 message = Shell::GetInstance()->system_tray_delegate()-> | 37 base::string16 message = Shell::GetInstance()->system_tray_delegate()-> |
39 GetLocallyManagedUserMessage(); | 38 GetLocallyManagedUserMessage(); |
40 message_view_->SetMessage(message); | 39 message_view_->SetMessage(message); |
41 } | 40 } |
42 | 41 |
43 LabelTrayView* message_view_; | 42 LabelTrayView* message_view_; |
44 TrayLocallyManagedUser* tray_managed_; | 43 TrayLocallyManagedUser* tray_managed_; |
45 | 44 |
46 DISALLOW_COPY_AND_ASSIGN(ManagedUserNotificationView); | 45 DISALLOW_COPY_AND_ASSIGN(ManagedUserNotificationView); |
47 }; | 46 }; |
(...skipping 26 matching lines...) Expand all Loading... |
74 notification_view_ = new ManagedUserNotificationView(this); | 73 notification_view_ = new ManagedUserNotificationView(this); |
75 return notification_view_; | 74 return notification_view_; |
76 } | 75 } |
77 | 76 |
78 views::View* TrayLocallyManagedUser::CreateDefaultView( | 77 views::View* TrayLocallyManagedUser::CreateDefaultView( |
79 user::LoginStatus status) { | 78 user::LoginStatus status) { |
80 CHECK(tray_view_ == NULL); | 79 CHECK(tray_view_ == NULL); |
81 if (status != ash::user::LOGGED_IN_LOCALLY_MANAGED) | 80 if (status != ash::user::LOGGED_IN_LOCALLY_MANAGED) |
82 return NULL; | 81 return NULL; |
83 | 82 |
84 // TODO(antrim): replace to appropriate icon when there is one. | 83 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_MANAGED_USER); |
85 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE_DARK); | |
86 UpdateMessage(); | 84 UpdateMessage(); |
87 return tray_view_; | 85 return tray_view_; |
88 } | 86 } |
89 | 87 |
90 void TrayLocallyManagedUser::DestroyDefaultView() { | 88 void TrayLocallyManagedUser::DestroyDefaultView() { |
91 tray_view_ = NULL; | 89 tray_view_ = NULL; |
92 } | 90 } |
93 | 91 |
94 void TrayLocallyManagedUser::DestroyNotificationView() { | 92 void TrayLocallyManagedUser::DestroyNotificationView() { |
95 notification_view_ = NULL; | 93 notification_view_ = NULL; |
96 } | 94 } |
97 | 95 |
98 void TrayLocallyManagedUser::OnViewClicked(views::View* sender) { | 96 void TrayLocallyManagedUser::OnViewClicked(views::View* sender) { |
99 Shell::GetInstance()->system_tray_delegate()->ShowLocallyManagedUserInfo(); | 97 Shell::GetInstance()->system_tray_delegate()->ShowLocallyManagedUserInfo(); |
100 } | 98 } |
101 | 99 |
102 void TrayLocallyManagedUser::UpdateAfterLoginStatusChange( | 100 void TrayLocallyManagedUser::UpdateAfterLoginStatusChange( |
103 user::LoginStatus status) { | 101 user::LoginStatus status) { |
104 if (status == ash::user::LOGGED_IN_LOCALLY_MANAGED) | 102 if (status == ash::user::LOGGED_IN_LOCALLY_MANAGED) |
105 ShowNotificationView(); | 103 ShowNotificationView(); |
106 } | 104 } |
107 | 105 |
108 } // namespace internal | 106 } // namespace internal |
109 } // namespace ash | 107 } // namespace ash |
110 | 108 |
OLD | NEW |