OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile_info_entry.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 |
| 9 namespace { |
| 10 |
| 11 const char kNameKey[] = "name"; |
| 12 const char kShortcutNameKey[] = "shortcut_name"; |
| 13 const char kGAIANameKey[] = "gaia_name"; |
| 14 const char kGAIAGivenNameKey[] = "gaia_given_name"; |
| 15 const char kUseGAIANameKey[] = "use_gaia_name"; |
| 16 const char kUserNameKey[] = "user_name"; |
| 17 const char kAvatarIconKey[] = "avatar_icon"; |
| 18 const char kUseGAIAPictureKey[] = "use_gaia_picture"; |
| 19 const char kBackgroundAppsKey[] = "background_apps"; |
| 20 const char kHasMigratedToGAIAInfoKey[] = "has_migrated_to_gaia_info"; |
| 21 const char kGAIAPictureFileNameKey[] = "gaia_picture_file_name"; |
| 22 const char kIsManagedKey[] = "is_managed"; |
| 23 const char kSigninRequiredKey[] = "signin_required"; |
| 24 const char kManagedUserId[] = "managed_user_id"; |
| 25 |
| 26 const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; |
| 27 const char kGAIAPictureFileName[] = "Google Profile Picture.png"; |
| 28 |
| 29 } |
| 30 |
| 31 ProfileInfoEntry::ProfileInfoEntry() |
| 32 : icon_index_(0), |
| 33 is_running_background_apps_(false) { |
| 34 } |
| 35 |
| 36 ProfileInfoEntry::ProfileInfoEntry(const base::FilePath& path, |
| 37 const base::DictionaryValue& info) |
| 38 : path_(path), |
| 39 icon_index_(0), |
| 40 is_running_background_apps_(false) { |
| 41 info.GetString(kNameKey, &name_); |
| 42 info.GetString(kUserNameKey, &user_name_); |
| 43 std::string icon_url; |
| 44 info.GetString(kAvatarIconKey, &icon_url); |
| 45 size_t icon_index = 0; |
| 46 |
| 47 |
| 48 //if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) |
| 49 // icon_index_ = icon_index; |
| 50 |
| 51 info.GetBoolean(kBackgroundAppsKey, &is_running_background_apps_); |
| 52 } |
| 53 |
| 54 ProfileInfoEntry& ProfileInfoEntry::operator=(const ProfileInfoEntry& entry) { |
| 55 name_ = entry.name_; |
| 56 user_name_ = entry.user_name_; |
| 57 icon_index_ = entry.icon_index_; |
| 58 is_running_background_apps_ = entry.is_running_background_apps_; |
| 59 return *this; |
| 60 } |
| 61 |
| 62 bool ProfileInfoEntry::operator<(const ProfileInfoEntry& rhs) const { |
| 63 int compare = name_.compare(rhs.name()); |
| 64 |
| 65 if (compare < 0) |
| 66 return true; |
| 67 if (compare > 0) |
| 68 return false; |
| 69 return icon_index_ < rhs.icon_index_; |
| 70 } |
OLD | NEW |