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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 #else | 374 #else |
375 NOTREACHED(); | 375 NOTREACHED(); |
376 return NULL; | 376 return NULL; |
377 #endif | 377 #endif |
378 } | 378 } |
379 | 379 |
380 void MessageCenterSettingsController::RebuildNotifierGroups() { | 380 void MessageCenterSettingsController::RebuildNotifierGroups() { |
381 notifier_groups_.clear(); | 381 notifier_groups_.clear(); |
382 current_notifier_group_ = 0; | 382 current_notifier_group_ = 0; |
383 | 383 |
384 const size_t count = profile_info_cache_->GetNumberOfProfiles(); | 384 const std::vector<ProfileInfoEntry> entries( |
385 | 385 profile_info_cache_->GetProfilesSortedByName()); |
386 for (size_t i = 0; i < count; ++i) { | 386 int index = 0; |
| 387 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 388 it != entries.end(); ++it) { |
387 scoped_ptr<message_center::ProfileNotifierGroup> group( | 389 scoped_ptr<message_center::ProfileNotifierGroup> group( |
388 new message_center::ProfileNotifierGroup( | 390 new message_center::ProfileNotifierGroup( |
389 profile_info_cache_->GetAvatarIconOfProfileAtIndex(i), | 391 profile_info_cache_->GetAvatarIconOfProfile(it->path()), |
390 profile_info_cache_->GetNameOfProfileAtIndex(i), | 392 it->GetDisplayName(), |
391 profile_info_cache_->GetUserNameOfProfileAtIndex(i), | 393 it->user_name(), |
392 i, | 394 index++, |
393 profile_info_cache_->GetPathOfProfileAtIndex(i))); | 395 it->path())); |
394 if (group->profile() == NULL) | 396 if (group->profile() == NULL) |
395 continue; | 397 continue; |
396 | 398 |
397 #if defined(OS_CHROMEOS) | 399 #if defined(OS_CHROMEOS) |
398 // In ChromeOS, the login screen first creates a dummy profile which is not | 400 // In ChromeOS, the login screen first creates a dummy profile which is not |
399 // actually used, and then the real profile for the user is created when | 401 // actually used, and then the real profile for the user is created when |
400 // login (or turns into kiosk mode). This profile should be skipped. | 402 // login (or turns into kiosk mode). This profile should be skipped. |
401 if (chromeos::ProfileHelper::IsSigninProfile(group->profile())) | 403 if (chromeos::ProfileHelper::IsSigninProfile(group->profile())) |
402 continue; | 404 continue; |
403 #endif | 405 #endif |
404 notifier_groups_.push_back(group.release()); | 406 notifier_groups_.push_back(group.release()); |
405 } | 407 } |
406 } | 408 } |
OLD | NEW |