Index: chrome/browser/profiles/profile_info_entry.cc |
diff --git a/chrome/browser/profiles/profile_info_entry.cc b/chrome/browser/profiles/profile_info_entry.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2cc86d249e08101972ab201956c1d6cebe540e8b |
--- /dev/null |
+++ b/chrome/browser/profiles/profile_info_entry.cc |
@@ -0,0 +1,70 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/profiles/profile_info_entry.h" |
+ |
+#include "base/values.h" |
+ |
+namespace { |
+ |
+const char kNameKey[] = "name"; |
+const char kShortcutNameKey[] = "shortcut_name"; |
+const char kGAIANameKey[] = "gaia_name"; |
+const char kGAIAGivenNameKey[] = "gaia_given_name"; |
+const char kUseGAIANameKey[] = "use_gaia_name"; |
+const char kUserNameKey[] = "user_name"; |
+const char kAvatarIconKey[] = "avatar_icon"; |
+const char kUseGAIAPictureKey[] = "use_gaia_picture"; |
+const char kBackgroundAppsKey[] = "background_apps"; |
+const char kHasMigratedToGAIAInfoKey[] = "has_migrated_to_gaia_info"; |
+const char kGAIAPictureFileNameKey[] = "gaia_picture_file_name"; |
+const char kIsManagedKey[] = "is_managed"; |
+const char kSigninRequiredKey[] = "signin_required"; |
+const char kManagedUserId[] = "managed_user_id"; |
+ |
+const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; |
+const char kGAIAPictureFileName[] = "Google Profile Picture.png"; |
+ |
+} |
+ |
+ProfileInfoEntry::ProfileInfoEntry() |
+ : icon_index_(0), |
+ is_running_background_apps_(false) { |
+} |
+ |
+ProfileInfoEntry::ProfileInfoEntry(const base::FilePath& path, |
+ const base::DictionaryValue& info) |
+ : path_(path), |
+ icon_index_(0), |
+ is_running_background_apps_(false) { |
+ info.GetString(kNameKey, &name_); |
+ info.GetString(kUserNameKey, &user_name_); |
+ std::string icon_url; |
+ info.GetString(kAvatarIconKey, &icon_url); |
+ size_t icon_index = 0; |
+ |
+ |
+ //if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) |
+ // icon_index_ = icon_index; |
+ |
+ info.GetBoolean(kBackgroundAppsKey, &is_running_background_apps_); |
+} |
+ |
+ProfileInfoEntry& ProfileInfoEntry::operator=(const ProfileInfoEntry& entry) { |
+ name_ = entry.name_; |
+ user_name_ = entry.user_name_; |
+ icon_index_ = entry.icon_index_; |
+ is_running_background_apps_ = entry.is_running_background_apps_; |
+ return *this; |
+} |
+ |
+bool ProfileInfoEntry::operator<(const ProfileInfoEntry& rhs) const { |
+ int compare = name_.compare(rhs.name()); |
+ |
+ if (compare < 0) |
+ return true; |
+ if (compare > 0) |
+ return false; |
+ return icon_index_ < rhs.icon_index_; |
+} |