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

Side by Side Diff: ash/system/chromeos/managed/tray_locally_managed_user.cc

Issue 324583002: The 1st patch to disambiguate message center notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 6 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 (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/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/label_tray_view.h" 8 #include "ash/system/chromeos/label_tray_view.h"
9 #include "ash/system/system_notifier.h" 9 #include "ash/system/system_notifier.h"
10 #include "ash/system/tray/system_tray_notifier.h" 10 #include "ash/system/tray/system_tray_notifier.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 TrayLocallyManagedUser::~TrayLocallyManagedUser() { 34 TrayLocallyManagedUser::~TrayLocallyManagedUser() {
35 } 35 }
36 36
37 void TrayLocallyManagedUser::UpdateMessage() { 37 void TrayLocallyManagedUser::UpdateMessage() {
38 base::string16 message = Shell::GetInstance()->system_tray_delegate()-> 38 base::string16 message = Shell::GetInstance()->system_tray_delegate()->
39 GetLocallyManagedUserMessage(); 39 GetLocallyManagedUserMessage();
40 if (tray_view_) 40 if (tray_view_)
41 tray_view_->SetMessage(message); 41 tray_view_->SetMessage(message);
42 if (message_center::MessageCenter::Get()->HasNotification(kNotificationId)) 42 if (message_center::MessageCenter::Get()->FindVisibleNotificationById(
43 kNotificationId))
43 CreateOrUpdateNotification(message); 44 CreateOrUpdateNotification(message);
44 } 45 }
45 46
46 views::View* TrayLocallyManagedUser::CreateDefaultView( 47 views::View* TrayLocallyManagedUser::CreateDefaultView(
47 user::LoginStatus status) { 48 user::LoginStatus status) {
48 CHECK(tray_view_ == NULL); 49 CHECK(tray_view_ == NULL);
49 if (status != ash::user::LOGGED_IN_LOCALLY_MANAGED) 50 if (status != ash::user::LOGGED_IN_LOCALLY_MANAGED)
50 return NULL; 51 return NULL;
51 52
52 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_MANAGED_USER); 53 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_MANAGED_USER);
(...skipping 29 matching lines...) Expand all
82 kNotificationId, 83 kNotificationId,
83 base::string16() /* no title */, 84 base::string16() /* no title */,
84 new_message, 85 new_message,
85 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_MANAGED_USER), 86 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_MANAGED_USER),
86 system_notifier::kNotifierLocallyManagedUser, 87 system_notifier::kNotifierLocallyManagedUser,
87 base::Closure() /* null callback */)); 88 base::Closure() /* null callback */));
88 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); 89 message_center::MessageCenter::Get()->AddNotification(notification.Pass());
89 } 90 }
90 91
91 } // namespace ash 92 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698