| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/notifications/message_center_settings_controller.h" | 5 #include "chrome/browser/notifications/message_center_settings_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/string_compare.h" | 10 #include "base/i18n/string_compare.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // Already created. | 445 // Already created. |
| 446 if (!notifier_groups_.empty()) | 446 if (!notifier_groups_.empty()) |
| 447 return; | 447 return; |
| 448 | 448 |
| 449 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 449 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 450 // |notifier_groups_| can be empty in login screen too. | 450 // |notifier_groups_| can be empty in login screen too. |
| 451 if (!user_manager->IsLoggedInAsGuest()) | 451 if (!user_manager->IsLoggedInAsGuest()) |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 user_manager::User* user = user_manager->GetActiveUser(); | 454 user_manager::User* user = user_manager->GetActiveUser(); |
| 455 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); | 455 Profile* profile = |
| 456 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 456 DCHECK(profile); | 457 DCHECK(profile); |
| 457 notifier_groups_.push_back( | 458 notifier_groups_.push_back( |
| 458 new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), | 459 new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), |
| 459 user->GetDisplayName(), | 460 user->GetDisplayName(), |
| 460 user->GetDisplayName(), | 461 user->GetDisplayName(), |
| 461 0, | 462 0, |
| 462 profile)); | 463 profile)); |
| 463 | 464 |
| 464 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 465 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
| 465 observers_, | 466 observers_, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // another creating a primary profile, and causes an infinite loop. | 518 // another creating a primary profile, and causes an infinite loop. |
| 518 // Thus, it would be better to delay creating group for guest login. | 519 // Thus, it would be better to delay creating group for guest login. |
| 519 base::MessageLoopProxy::current()->PostTask( | 520 base::MessageLoopProxy::current()->PostTask( |
| 520 FROM_HERE, | 521 FROM_HERE, |
| 521 base::Bind( | 522 base::Bind( |
| 522 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 523 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
| 523 weak_factory_.GetWeakPtr())); | 524 weak_factory_.GetWeakPtr())); |
| 524 } | 525 } |
| 525 #endif | 526 #endif |
| 526 } | 527 } |
| OLD | NEW |