| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 const GURL& url, | 404 const GURL& url, |
| 405 const favicon_base::FaviconImageResult& favicon_result) { | 405 const favicon_base::FaviconImageResult& favicon_result) { |
| 406 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 406 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
| 407 observers_, | 407 observers_, |
| 408 UpdateIconImage(NotifierId(url), favicon_result.image)); | 408 UpdateIconImage(NotifierId(url), favicon_result.image)); |
| 409 } | 409 } |
| 410 | 410 |
| 411 | 411 |
| 412 #if defined(OS_CHROMEOS) | 412 #if defined(OS_CHROMEOS) |
| 413 void MessageCenterSettingsController::ActiveUserChanged( | 413 void MessageCenterSettingsController::ActiveUserChanged( |
| 414 const chromeos::User* active_user) { | 414 const user_manager::User* active_user) { |
| 415 RebuildNotifierGroups(); | 415 RebuildNotifierGroups(); |
| 416 } | 416 } |
| 417 #endif | 417 #endif |
| 418 | 418 |
| 419 void MessageCenterSettingsController::SetAppImage(const std::string& id, | 419 void MessageCenterSettingsController::SetAppImage(const std::string& id, |
| 420 const gfx::ImageSkia& image) { | 420 const gfx::ImageSkia& image) { |
| 421 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 421 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
| 422 observers_, | 422 observers_, |
| 423 UpdateIconImage(NotifierId(NotifierId::APPLICATION, id), | 423 UpdateIconImage(NotifierId(NotifierId::APPLICATION, id), |
| 424 gfx::Image(image))); | 424 gfx::Image(image))); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 445 void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { | 445 void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { |
| 446 // Already created. | 446 // Already created. |
| 447 if (!notifier_groups_.empty()) | 447 if (!notifier_groups_.empty()) |
| 448 return; | 448 return; |
| 449 | 449 |
| 450 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 450 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 451 // |notifier_groups_| can be empty in login screen too. | 451 // |notifier_groups_| can be empty in login screen too. |
| 452 if (!user_manager->IsLoggedInAsGuest()) | 452 if (!user_manager->IsLoggedInAsGuest()) |
| 453 return; | 453 return; |
| 454 | 454 |
| 455 chromeos::User* user = user_manager->GetActiveUser(); | 455 user_manager::User* user = user_manager->GetActiveUser(); |
| 456 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); | 456 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); |
| 457 DCHECK(profile); | 457 DCHECK(profile); |
| 458 notifier_groups_.push_back( | 458 notifier_groups_.push_back( |
| 459 new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), | 459 new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), |
| 460 user->GetDisplayName(), | 460 user->GetDisplayName(), |
| 461 user->GetDisplayName(), | 461 user->GetDisplayName(), |
| 462 0, | 462 0, |
| 463 profile)); | 463 profile)); |
| 464 | 464 |
| 465 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 465 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // another creating a primary profile, and causes an infinite loop. | 518 // another creating a primary profile, and causes an infinite loop. |
| 519 // 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. |
| 520 base::MessageLoopProxy::current()->PostTask( | 520 base::MessageLoopProxy::current()->PostTask( |
| 521 FROM_HERE, | 521 FROM_HERE, |
| 522 base::Bind( | 522 base::Bind( |
| 523 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 523 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
| 524 weak_factory_.GetWeakPtr())); | 524 weak_factory_.GetWeakPtr())); |
| 525 } | 525 } |
| 526 #endif | 526 #endif |
| 527 } | 527 } |
| OLD | NEW |