diff options
author | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-09 04:02:54 +0000 |
---|---|---|
committer | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-09 04:02:54 +0000 |
commit | c3e559771caa0e5feb4e1942ee8cf1967bf388be (patch) | |
tree | 482e8bcdc2536b020262d8f9d6210a55f838fce7 | |
parent | a4dc5ae5ba59f39840e4b2079b5d8d9b4e9ff9dd (diff) | |
download | chromium_src-c3e559771caa0e5feb4e1942ee8cf1967bf388be.zip chromium_src-c3e559771caa0e5feb4e1942ee8cf1967bf388be.tar.gz chromium_src-c3e559771caa0e5feb4e1942ee8cf1967bf388be.tar.bz2 |
Rename profile_info_util to profile_avatar_icon_util.
Also move avatar icon resource functionality from profile_info_cache to profile_avatar_icon_util.
BUG=337986
TBR=davemoore
Review URL: https://codereview.chromium.org/220983002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262605 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 219 insertions, 189 deletions
diff --git a/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc b/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc index 2dc84fd..a2507ba 100644 --- a/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc +++ b/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc @@ -8,7 +8,7 @@ #include "ash/shell.h" #include "ash/system/tray/system_tray_delegate.h" #include "chrome/browser/chromeos/login/user_manager.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/ui/browser.h" // static diff --git a/chrome/browser/chromeos/profiles/profile_list_chromeos.cc b/chrome/browser/chromeos/profiles/profile_list_chromeos.cc index c218277..992e758 100644 --- a/chrome/browser/chromeos/profiles/profile_list_chromeos.cc +++ b/chrome/browser/chromeos/profiles/profile_list_chromeos.cc @@ -10,7 +10,7 @@ #include "base/command_line.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/managed_mode/managed_user_sync_service.cc b/chrome/browser/managed_mode/managed_user_sync_service.cc index dc17b35..fa0730c 100644 --- a/chrome/browser/managed_mode/managed_user_sync_service.cc +++ b/chrome/browser/managed_mode/managed_user_sync_service.cc @@ -10,7 +10,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/values.h" -#include "chrome/browser/profiles/profile_info_cache.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/common/pref_names.h" #include "components/user_prefs/pref_registry_syncable.h" #include "sync/api/sync_change.h" @@ -178,7 +178,7 @@ bool ManagedUserSyncService::GetAvatarIndex(const std::string& avatar_str, return (*avatar_index == kNoAvatar || (*avatar_index >= 0 && static_cast<size_t>(*avatar_index) < - ProfileInfoCache::GetDefaultAvatarIconCount())); + profiles::GetDefaultAvatarIconCount())); #endif } diff --git a/chrome/browser/profiles/profile_info_util.cc b/chrome/browser/profiles/profile_avatar_icon_util.cc index bbca238..30c0661 100644 --- a/chrome/browser/profiles/profile_info_util.cc +++ b/chrome/browser/profiles/profile_avatar_icon_util.cc @@ -1,14 +1,20 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" +#include "base/format_macros.h" #include "base/memory/scoped_ptr.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" +#include "grit/generated_resources.h" +#include "grit/theme_resources.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkScalar.h" #include "third_party/skia/include/core/SkXfermode.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/canvas_image_source.h" #include "ui/gfx/image/image_skia_operations.h" @@ -176,6 +182,75 @@ const int kAvatarIconPadding = 2; const SkColor kAvatarTutorialBackgroundColor = SkColorSetRGB(0x42, 0x85, 0xf4); const SkColor kAvatarTutorialContentTextColor = SkColorSetRGB(0xc6, 0xda, 0xfc); +const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; +const char kGAIAPictureFileName[] = "Google Profile Picture.png"; +const char kHighResAvatarFolderName[] = "Avatars"; + +const int kDefaultAvatarIconResources[] = { + IDR_PROFILE_AVATAR_0, + IDR_PROFILE_AVATAR_1, + IDR_PROFILE_AVATAR_2, + IDR_PROFILE_AVATAR_3, + IDR_PROFILE_AVATAR_4, + IDR_PROFILE_AVATAR_5, + IDR_PROFILE_AVATAR_6, + IDR_PROFILE_AVATAR_7, + IDR_PROFILE_AVATAR_8, + IDR_PROFILE_AVATAR_9, + IDR_PROFILE_AVATAR_10, + IDR_PROFILE_AVATAR_11, + IDR_PROFILE_AVATAR_12, + IDR_PROFILE_AVATAR_13, + IDR_PROFILE_AVATAR_14, + IDR_PROFILE_AVATAR_15, + IDR_PROFILE_AVATAR_16, + IDR_PROFILE_AVATAR_17, + IDR_PROFILE_AVATAR_18, + IDR_PROFILE_AVATAR_19, + IDR_PROFILE_AVATAR_20, + IDR_PROFILE_AVATAR_21, + IDR_PROFILE_AVATAR_22, + IDR_PROFILE_AVATAR_23, + IDR_PROFILE_AVATAR_24, + IDR_PROFILE_AVATAR_25, +}; + +// File names for the high-res avatar icon resources. In the same order as +// the avatars in kDefaultAvatarIconResources. +const char* kDefaultAvatarIconResourceFileNames[] = { + "avatar_generic.png", + "avatar_generic_aqua.png", + "avatar_generic_blue.png", + "avatar_generic_green.png", + "avatar_generic_orange.png", + "avatar_generic_purple.png", + "avatar_generic_red.png", + "avatar_generic_yellow.png", + "avatar_secret_agent.png", + "avatar_superhero.png", + "avatar_volley_ball.png", + "avatar_businessman.png", + "avatar_ninja.png", + "avatar_alien.png", + "avatar_smiley.png", + "avatar_flower.png", + "avatar_pizza.png", + "avatar_soccer.png", + "avatar_burger.png", + "avatar_cat.png", + "avatar_cupcake.png", + "avatar_dog.png", + "avatar_horse.png", + "avatar_margarita.png", + "avatar_note.png", + "avatar_sun_cloud.png", +}; + +const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources); + +// The first 8 icons are generic. +const size_t kGenericAvatarIconsCount = 8; + gfx::Image GetSizedAvatarIconWithBorder(const gfx::Image& image, bool is_rectangle, int width, int height) { @@ -245,4 +320,52 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, return gfx::Image(gfx::ImageSkia(source.release(), dst_size)); } +// Helper methods for accessing, transforming and drawing avatar icons. +size_t GetDefaultAvatarIconCount() { + return kDefaultAvatarIconsCount; +} + +size_t GetGenericAvatarIconCount() { + return kGenericAvatarIconsCount; +} + +int GetDefaultAvatarIconResourceIDAtIndex(size_t index) { + DCHECK(IsDefaultAvatarIconIndex(index)); + return kDefaultAvatarIconResources[index]; +} + +const char* GetDefaultAvatarIconFileNameAtIndex(size_t index) { + return kDefaultAvatarIconResourceFileNames[index]; +} + +std::string GetDefaultAvatarIconUrl(size_t index) { + DCHECK(IsDefaultAvatarIconIndex(index)); + return base::StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index); +} + +bool IsDefaultAvatarIconIndex(size_t index) { + return index < kDefaultAvatarIconsCount; +} + +bool IsDefaultAvatarIconUrl(const std::string& url, + size_t* icon_index) { + DCHECK(icon_index); + if (url.find(kDefaultUrlPrefix) != 0) + return false; + + int int_value = -1; + if (base::StringToInt(base::StringPiece(url.begin() + + strlen(kDefaultUrlPrefix), + url.end()), + &int_value)) { + if (int_value < 0 || + int_value >= static_cast<int>(kDefaultAvatarIconsCount)) + return false; + *icon_index = int_value; + return true; + } + + return false; +} + } // namespace profiles diff --git a/chrome/browser/profiles/profile_info_util.h b/chrome/browser/profiles/profile_avatar_icon_util.h index 3b4f876..ea26029 100644 --- a/chrome/browser/profiles/profile_info_util.h +++ b/chrome/browser/profiles/profile_avatar_icon_util.h @@ -1,21 +1,47 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_UTIL_H_ -#define CHROME_BROWSER_PROFILES_PROFILE_INFO_UTIL_H_ +#ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ +#define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/image/image.h" namespace profiles { +// Avatar access. +extern const char kGAIAPictureFileName[]; +extern const char kHighResAvatarFolderName[]; + +// Avatar formatting. extern const int kAvatarIconWidth; extern const int kAvatarIconHeight; extern const int kAvatarIconPadding; extern const SkColor kAvatarTutorialBackgroundColor; extern const SkColor kAvatarTutorialContentTextColor; +// Gets the number of default avatar icons that exist. +size_t GetDefaultAvatarIconCount(); + +// Gets the number of generic avatar icons that exist. +size_t GetGenericAvatarIconCount(); + +// Gets the resource ID of the default avatar icon at |index|. +int GetDefaultAvatarIconResourceIDAtIndex(size_t index); + +// Gets the resource filename of the default avatar icon at |index|. +const char* GetDefaultAvatarIconFileNameAtIndex(size_t index); + +// Returns a URL for the default avatar icon with specified index. +std::string GetDefaultAvatarIconUrl(size_t index); + +// Checks if |index| is a valid avatar icon index +bool IsDefaultAvatarIconIndex(size_t index); + +// Checks if the given URL points to one of the default avatar icons. If it +// is, returns true and its index through |icon_index|. If not, returns false. +bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); // Returns a version of |image| of a specific size and with a grey border. // Note that no checks are done on the width/height so make sure they're // reasonable values; in the range of 16-256 is probably best. @@ -40,4 +66,4 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, } // namespace profiles -#endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_UTIL_H_ +#endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ diff --git a/chrome/browser/profiles/profile_info_util_unittest.cc b/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc index 786e5b7..bf5e7c2 100644 --- a/chrome/browser/profiles/profile_info_util_unittest.cc +++ b/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 8c35787..c8c63c0 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/file_util.h" -#include "base/format_macros.h" #include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -18,11 +17,11 @@ #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/common/profile_management_switches.h" @@ -58,75 +57,6 @@ const char kManagedUserId[] = "managed_user_id"; const char kProfileIsEphemeral[] = "is_ephemeral"; const char kActiveTimeKey[] = "active_time"; -const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; -const char kGAIAPictureFileName[] = "Google Profile Picture.png"; -const char kHighResAvatarFolderName[] = "Avatars"; - -const int kDefaultAvatarIconResources[] = { - IDR_PROFILE_AVATAR_0, - IDR_PROFILE_AVATAR_1, - IDR_PROFILE_AVATAR_2, - IDR_PROFILE_AVATAR_3, - IDR_PROFILE_AVATAR_4, - IDR_PROFILE_AVATAR_5, - IDR_PROFILE_AVATAR_6, - IDR_PROFILE_AVATAR_7, - IDR_PROFILE_AVATAR_8, - IDR_PROFILE_AVATAR_9, - IDR_PROFILE_AVATAR_10, - IDR_PROFILE_AVATAR_11, - IDR_PROFILE_AVATAR_12, - IDR_PROFILE_AVATAR_13, - IDR_PROFILE_AVATAR_14, - IDR_PROFILE_AVATAR_15, - IDR_PROFILE_AVATAR_16, - IDR_PROFILE_AVATAR_17, - IDR_PROFILE_AVATAR_18, - IDR_PROFILE_AVATAR_19, - IDR_PROFILE_AVATAR_20, - IDR_PROFILE_AVATAR_21, - IDR_PROFILE_AVATAR_22, - IDR_PROFILE_AVATAR_23, - IDR_PROFILE_AVATAR_24, - IDR_PROFILE_AVATAR_25, -}; - -// File names for the high-res avatar icon resources. In the same order as -// the avatars in kDefaultAvatarIconResources. -const char* kDefaultAvatarIconResourceFileNames[] = { - "avatar_generic.png", - "avatar_generic_aqua.png", - "avatar_generic_blue.png", - "avatar_generic_green.png", - "avatar_generic_orange.png", - "avatar_generic_purple.png", - "avatar_generic_red.png", - "avatar_generic_yellow.png", - "avatar_secret_agent.png", - "avatar_superhero.png", - "avatar_volley_ball.png", - "avatar_businessman.png", - "avatar_ninja.png", - "avatar_alien.png", - "avatar_smiley.png", - "avatar_flower.png", - "avatar_pizza.png", - "avatar_soccer.png", - "avatar_burger.png", - "avatar_cat.png", - "avatar_cupcake.png", - "avatar_dog.png", - "avatar_horse.png", - "avatar_margarita.png", - "avatar_note.png", - "avatar_sun_cloud.png", -}; - -const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources); - -// The first 8 icons are generic. -const size_t kGenericIconCount = 8; - // First eight are generic icons, which use IDS_NUMBERED_PROFILE_NAME. const int kDefaultNames[] = { IDS_DEFAULT_AVATAR_NAME_8, @@ -276,7 +206,8 @@ void ProfileInfoCache::AddProfileToCache(const base::FilePath& profile_path, scoped_ptr<base::DictionaryValue> info(new base::DictionaryValue); info->SetString(kNameKey, name); info->SetString(kUserNameKey, username); - info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); + info->SetString(kAvatarIconKey, + profiles::GetDefaultAvatarIconUrl(icon_index)); // Default value for whether background apps are running is false. info->SetBoolean(kBackgroundAppsKey, false); info->SetString(kManagedUserId, managed_user_id); @@ -406,7 +337,7 @@ const gfx::Image& ProfileInfoCache::GetAvatarIconOfProfileAtIndex( return *image; } - int resource_id = GetDefaultAvatarIconResourceIDAtIndex( + int resource_id = profiles::GetDefaultAvatarIconResourceIDAtIndex( GetAvatarIconIndexOfProfileAtIndex(index)); return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); } @@ -462,12 +393,12 @@ const gfx::Image* ProfileInfoCache::GetGAIAPictureOfProfileAtIndex( const gfx::Image* ProfileInfoCache::GetHighResAvatarOfProfileAtIndex( size_t index) const { int avatar_index = GetAvatarIconIndexOfProfileAtIndex(index); - std::string key = kDefaultAvatarIconResourceFileNames[avatar_index]; + std::string key = profiles::GetDefaultAvatarIconFileNameAtIndex(avatar_index); base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); - base::FilePath image_path = - user_data_dir.AppendASCII(kHighResAvatarFolderName).AppendASCII(key); + base::FilePath image_path = user_data_dir. + AppendASCII(profiles::kHighResAvatarFolderName).AppendASCII(key); return LoadAvatarPictureFromPath(key, image_path); } @@ -576,7 +507,7 @@ size_t ProfileInfoCache::GetAvatarIconIndexOfProfileAtIndex(size_t index) std::string icon_url; GetInfoForProfileAtIndex(index)->GetString(kAvatarIconKey, &icon_url); size_t icon_index = 0; - if (!IsDefaultAvatarIconUrl(icon_url, &icon_index)) + if (!profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) DLOG(WARNING) << "Unknown avatar icon: " << icon_url; return icon_index; @@ -645,7 +576,8 @@ void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index) { scoped_ptr<base::DictionaryValue> info( GetInfoForProfileAtIndex(index)->DeepCopy()); - info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); + info->SetString(kAvatarIconKey, + profiles::GetDefaultAvatarIconUrl(icon_index)); // This takes ownership of |info|. SetInfoForProfileAtIndex(index, info.release()); @@ -766,8 +698,8 @@ void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, if (!data->size()) { LOG(ERROR) << "Failed to PNG encode the image."; } else { - new_file_name = - old_file_name.empty() ? kGAIAPictureFileName : old_file_name; + new_file_name = old_file_name.empty() ? + profiles::kGAIAPictureFileName : old_file_name; base::FilePath image_path = path.AppendASCII(new_file_name); bool* success = new bool; BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, @@ -850,12 +782,12 @@ base::string16 ProfileInfoCache::ChooseNameForNewProfile( if (switches::IsNewProfileManagement()) { name = l10n_util::GetStringFUTF16Int(IDS_NEW_NUMBERED_PROFILE_NAME, name_index); - } else if (icon_index < kGenericIconCount) { + } else if (icon_index < profiles::GetGenericAvatarIconCount()) { name = l10n_util::GetStringFUTF16Int(IDS_NUMBERED_PROFILE_NAME, name_index); } else { name = l10n_util::GetStringUTF16( - kDefaultNames[icon_index - kGenericIconCount]); + kDefaultNames[icon_index - profiles::GetGenericAvatarIconCount()]); if (name_index > 1) name.append(base::UTF8ToUTF16(base::IntToString(name_index))); } @@ -889,8 +821,8 @@ bool ProfileInfoCache::ChooseAvatarIconIndexForNewProfile( // --new-profile-management flag. if (switches::IsNewProfileManagement()) allow_generic_icon = true; - size_t start = allow_generic_icon ? 0 : kGenericIconCount; - size_t end = GetDefaultAvatarIconCount(); + size_t start = allow_generic_icon ? 0 : profiles::GetGenericAvatarIconCount(); + size_t end = profiles::GetDefaultAvatarIconCount(); size_t count = end - start; int rand = base::RandInt(0, count); @@ -925,50 +857,6 @@ const base::FilePath& ProfileInfoCache::GetUserDataDir() const { return user_data_dir_; } -// static -size_t ProfileInfoCache::GetDefaultAvatarIconCount() { - return kDefaultAvatarIconsCount; -} - -// static -int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) { - DCHECK(IsDefaultAvatarIconIndex(index)); - return kDefaultAvatarIconResources[index]; -} - -// static -std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) { - DCHECK(IsDefaultAvatarIconIndex(index)); - return base::StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index); -} - -// static -bool ProfileInfoCache::IsDefaultAvatarIconIndex(size_t index) { - return index < kDefaultAvatarIconsCount; -} - -// static -bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url, - size_t* icon_index) { - DCHECK(icon_index); - if (url.find(kDefaultUrlPrefix) != 0) - return false; - - int int_value = -1; - if (base::StringToInt(base::StringPiece(url.begin() + - strlen(kDefaultUrlPrefix), - url.end()), - &int_value)) { - if (int_value < 0 || - int_value >= static_cast<int>(kDefaultAvatarIconsCount)) - return false; - *icon_index = int_value; - return true; - } - - return false; -} - const base::DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex( size_t index) const { DCHECK_LT(index, GetNumberOfProfiles()); diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h index 07384f4..4b88fcb 100644 --- a/chrome/browser/profiles/profile_info_cache.h +++ b/chrome/browser/profiles/profile_info_cache.h @@ -126,19 +126,6 @@ class ProfileInfoCache : public ProfileInfoInterface, const base::FilePath& GetUserDataDir() const; - // Gets the number of default avatar icons that exist. - static size_t GetDefaultAvatarIconCount(); - // Gets the resource ID of the default avatar icon at |index|. - static int GetDefaultAvatarIconResourceIDAtIndex(size_t index); - // Returns a URL for the default avatar icon with specified index. - static std::string GetDefaultAvatarIconUrl(size_t index); - // Checks if |index| is a valid avatar icon index - static bool IsDefaultAvatarIconIndex(size_t index); - // Checks if the given URL points to one of the default avatar icons. If it - // is, returns true and its index through |icon_index|. If not, returns false. - static bool IsDefaultAvatarIconUrl(const std::string& icon_url, - size_t *icon_index); - // Gets all names of profiles associated with this instance of Chrome. // Because this method will be called during uninstall, before the creation // of the ProfileManager, it reads directly from the local state preferences, diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 3f9b1e4..0405b1f 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/prefs/pref_service_syncable.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/test/base/testing_browser_process.h" @@ -128,7 +129,7 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) { base::string16 profile_name = ASCIIToUTF16(base::StringPrintf("name_%ud", i)); const SkBitmap* icon = rb.GetImageNamed( - ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex( + profiles::GetDefaultAvatarIconResourceIDAtIndex( i)).ToSkBitmap(); std::string managed_user_id = i == 3 ? "TEST_ID" : ""; @@ -351,7 +352,7 @@ TEST_F(ProfileInfoCacheTest, GAIAPicture) { EXPECT_FALSE(GetCache()->IsUsingGAIAPictureOfProfileAtIndex(1)); // The profile icon should be the default one. - int id = ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(0); + int id = profiles::GetDefaultAvatarIconResourceIDAtIndex(0); const gfx::Image& profile_image( ResourceBundle::GetSharedInstance().GetImageNamed(id)); EXPECT_TRUE(gfx::test::IsEqual( @@ -429,7 +430,7 @@ TEST_F(ProfileInfoCacheTest, SetManagedUserId) { TEST_F(ProfileInfoCacheTest, EmptyGAIAInfo) { base::string16 profile_name = ASCIIToUTF16("name_1"); - int id = ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(0); + int id = profiles::GetDefaultAvatarIconResourceIDAtIndex(0); const gfx::Image& profile_image( ResourceBundle::GetSharedInstance().GetImageNamed(id)); diff --git a/chrome/browser/profiles/profile_list_desktop.cc b/chrome/browser/profiles/profile_list_desktop.cc index 73fa8ee..480ba5d 100644 --- a/chrome/browser/profiles/profile_list_desktop.cc +++ b/chrome/browser/profiles/profile_list_desktop.cc @@ -5,8 +5,8 @@ #include "chrome/browser/profiles/profile_list_desktop.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/common/profile_management_switches.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index acf1afb..67edae7 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -26,6 +26,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_destroyer.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_metrics.h" @@ -390,7 +391,7 @@ void ProfileManager::CreateProfileAsync( // Get the icon index from the user's icon url size_t icon_index; std::string icon_url_std = base::UTF16ToASCII(icon_url); - if (cache.IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) { + if (profiles::IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) { // add profile to cache with user selected name and avatar cache.AddProfileToCache(profile_path, name, base::string16(), icon_index, managed_user_id); diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index 803001c..82e8fd9 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -22,6 +22,7 @@ #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profiles_state.h" @@ -125,7 +126,7 @@ class ProfileManagerTest : public testing::Test { base::Bind(&MockObserver::OnProfileCreated, base::Unretained(mock_observer)), base::UTF8ToUTF16(name), - base::UTF8ToUTF16(ProfileInfoCache::GetDefaultAvatarIconUrl(0)), + base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(0)), is_managed ? "Dummy ID" : std::string()); } @@ -513,7 +514,7 @@ TEST_F(ProfileManagerTest, InitProfileUserPrefs) { // Check that the profile avatar index is valid size_t avatar_index = profile->GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); - EXPECT_TRUE(profile_manager->GetProfileInfoCache().IsDefaultAvatarIconIndex( + EXPECT_TRUE(profiles::IsDefaultAvatarIconIndex( avatar_index)); } diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index f19f9ee..d7f1beb 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -23,8 +23,8 @@ #include "chrome/browser/app_icon_win.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache_observer.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/shell_integration.h" #include "chrome/common/chrome_switches.h" @@ -666,7 +666,7 @@ ProfileShortcutManagerWin::ProfileShortcutManagerWin(ProfileManager* manager) : profile_manager_(manager) { DCHECK_EQ( arraysize(kProfileAvatarIconResources2x), - profile_manager_->GetProfileInfoCache().GetDefaultAvatarIconCount()); + profiles::GetDefaultAvatarIconCount()); registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, content::NotificationService::AllSources()); @@ -823,7 +823,7 @@ void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath( const size_t icon_index = cache->GetAvatarIconIndexOfProfileAtIndex(profile_index); const int resource_id_1x = - cache->GetDefaultAvatarIconResourceIDAtIndex(icon_index); + profiles::GetDefaultAvatarIconResourceIDAtIndex(icon_index); const int resource_id_2x = kProfileAvatarIconResources2x[icon_index]; // Make a copy of the SkBitmaps to ensure that we can safely use the image // data on the FILE thread. diff --git a/chrome/browser/ui/cocoa/browser/avatar_base_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_base_controller.mm index 7f43092..0669f0e 100644 --- a/chrome/browser/ui/cocoa/browser/avatar_base_controller.mm +++ b/chrome/browser/ui/cocoa/browser/avatar_base_controller.mm @@ -7,7 +7,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_info_cache_observer.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm index 7eca957..b973b0f 100644 --- a/chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm +++ b/chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm @@ -7,8 +7,8 @@ #include "base/strings/sys_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" diff --git a/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm index 0c9e0f4..bd0a6ab 100644 --- a/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm +++ b/chrome/browser/ui/cocoa/browser/profile_chooser_controller.mm @@ -15,8 +15,8 @@ #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/avatar_menu.h" #include "chrome/browser/profiles/avatar_menu_observer.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_window.h" diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index a6ff42d..fc4909f 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -13,7 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/fullscreen.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window_state.h" diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm index 4167286..7caaf7f 100644 --- a/chrome/browser/ui/cocoa/framed_browser_window.mm +++ b/chrome/browser/ui/cocoa/framed_browser_window.mm @@ -6,7 +6,7 @@ #include "base/logging.h" #include "chrome/browser/global_keyboard_shortcuts_mac.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/browser_window_utils.h" #import "chrome/browser/ui/cocoa/custom_frame_view.h" diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profile_menu_controller.mm index 3ac91ee..2b069ab 100644 --- a/chrome/browser/ui/cocoa/profile_menu_controller.mm +++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm @@ -10,9 +10,9 @@ #include "chrome/browser/profiles/avatar_menu.h" #include "chrome/browser/profiles/avatar_menu_observer.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_info_interface.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc index 08a24ba..40d375b 100644 --- a/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc +++ b/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc @@ -7,8 +7,8 @@ #include "base/i18n/rtl.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/command_updater.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_metrics.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index 0c9b25d..a3bdde4 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -14,6 +14,7 @@ #endif #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_manager.h" @@ -228,7 +229,7 @@ void OneClickSigninSyncStarter::CreateNewSignedInProfile() { GetProfileInfoCache().ChooseAvatarIconIndexForNewProfile(); ProfileManager::CreateMultiProfileAsync( base::UTF8ToUTF16(signin->GetUsernameForAuthInProgress()), - base::UTF8ToUTF16(ProfileInfoCache::GetDefaultAvatarIconUrl(icon_index)), + base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(icon_index)), base::Bind(&OneClickSigninSyncStarter::CompleteInitForNewProfile, weak_pointer_factory_.GetWeakPtr(), desktop_type_), std::string()); diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc index d2a18b2..98d0c47 100644 --- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc +++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc @@ -11,8 +11,8 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/avatar_menu.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/signin/signin_manager_factory.h" diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc index c4268bb..b1e589f 100644 --- a/chrome/browser/ui/views/avatar_menu_button.cc +++ b/chrome/browser/ui/views/avatar_menu_button.cc @@ -9,7 +9,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/avatar_menu.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" diff --git a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc index f238d05..99ca875 100644 --- a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc +++ b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc @@ -13,7 +13,7 @@ #include "base/win/scoped_comptr.h" #include "base/win/scoped_gdi_object.h" #include "base/win/windows_version.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/ui/host_desktop.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" diff --git a/chrome/browser/ui/views/profile_chooser_view.cc b/chrome/browser/ui/views/profile_chooser_view.cc index 640b3d6..f2dea66 100644 --- a/chrome/browser/ui/views/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profile_chooser_view.cc @@ -8,7 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/lifetime/application_lifetime.h" -#include "chrome/browser/profiles/profile_info_util.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/profiles/profiles_state.h" diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 8a445be..2f68fd0 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -38,8 +38,8 @@ #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_shortcut_manager.h" @@ -1195,7 +1195,7 @@ scoped_ptr<base::ListValue> BrowserOptionsHandler::GetProfilesInfoList() { } else { size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); profile_value->SetString("iconURL", - cache.GetDefaultAvatarIconUrl(icon_index)); + profiles::GetDefaultAvatarIconUrl(icon_index)); } profile_info_list->Append(profile_value); diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 66836b0..2030d17 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc @@ -17,8 +17,8 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/gaia_info_update_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_shortcut_manager.h" @@ -233,7 +233,8 @@ void ManageProfileHandler::RequestNewProfileDefaults( base::DictionaryValue profile_info; profile_info.SetString("name", cache.ChooseNameForNewProfile(icon_index)); - profile_info.SetString("iconURL", cache.GetDefaultAvatarIconUrl(icon_index)); + profile_info.SetString("iconURL", + profiles::GetDefaultAvatarIconUrl(icon_index)); web_ui()->CallJavascriptFunction( "ManageProfileOverlay.receiveNewProfileDefaults", profile_info); @@ -261,8 +262,8 @@ void ManageProfileHandler::SendProfileIconsAndNames( } // Next add the default avatar icons and names. - for (size_t i = 0; i < ProfileInfoCache::GetDefaultAvatarIconCount(); i++) { - std::string url = ProfileInfoCache::GetDefaultAvatarIconUrl(i); + for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount(); i++) { + std::string url = profiles::GetDefaultAvatarIconUrl(i); image_url_list.AppendString(url); default_name_list.AppendString(cache.ChooseNameForNewProfile(i)); } @@ -320,7 +321,7 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) { // below. ProfileMetrics::LogProfileSwitchGaia(ProfileMetrics::GAIA_OPT_IN); } - } else if (cache.IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) { + } else if (profiles::IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) { ProfileMetrics::LogProfileAvatarSelection(new_icon_index); PrefService* pref_service = profile->GetPrefs(); // Updating the profile preference will cause the cache to be updated for diff --git a/chrome/browser/ui/webui/options/managed_user_import_handler.cc b/chrome/browser/ui/webui/options/managed_user_import_handler.cc index e4dbb4c..c19021b 100644 --- a/chrome/browser/ui/webui/options/managed_user_import_handler.cc +++ b/chrome/browser/ui/webui/options/managed_user_import_handler.cc @@ -16,6 +16,7 @@ #include "chrome/browser/managed_mode/managed_user_sync_service.h" #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -34,8 +35,8 @@ namespace { scoped_ptr<base::ListValue> GetAvatarIcons() { scoped_ptr<base::ListValue> avatar_icons(new base::ListValue); - for (size_t i = 0; i < ProfileInfoCache::GetDefaultAvatarIconCount(); ++i) { - std::string avatar_url = ProfileInfoCache::GetDefaultAvatarIconUrl(i); + for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount(); ++i) { + std::string avatar_url = profiles::GetDefaultAvatarIconUrl(i); avatar_icons->Append(new base::StringValue(avatar_url)); } @@ -190,7 +191,7 @@ void ManagedUserImportHandler::SendExistingManagedUsers( std::string avatar_url = avatar_index == ManagedUserSyncService::kNoAvatar ? supervised_user_icon : - ProfileInfoCache::GetDefaultAvatarIconUrl(avatar_index); + profiles::GetDefaultAvatarIconUrl(avatar_index); managed_user->SetString("iconURL", avatar_url); bool on_current_device = managed_user_ids.find(it.key()) != managed_user_ids.end(); diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 00201ec..e7a58cf 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc @@ -9,9 +9,9 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_info_cache_observer.h" -#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/profiles/profiles_state.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e4cce4a..a8d59ec 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1813,8 +1813,8 @@ 'browser/profiles/profile_info_cache.h', 'browser/profiles/profile_info_cache_observer.h', 'browser/profiles/profile_info_interface.h', - 'browser/profiles/profile_info_util.cc', - 'browser/profiles/profile_info_util.h', + 'browser/profiles/profile_avatar_icon_util.cc', + 'browser/profiles/profile_avatar_icon_util.h', 'browser/profiles/profile_io_data.cc', 'browser/profiles/profile_io_data.h', 'browser/profiles/profile_list.h', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 8b69e9c..d3901cd 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1193,7 +1193,7 @@ 'browser/profiles/profile_downloader_unittest.cc', 'browser/profiles/profile_info_cache_unittest.cc', 'browser/profiles/profile_info_cache_unittest.h', - 'browser/profiles/profile_info_util_unittest.cc', + 'browser/profiles/profile_avatar_icon_util_unittest.cc', 'browser/profiles/profile_list_desktop_unittest.cc', 'browser/profiles/profile_manager_unittest.cc', 'browser/profiles/profile_shortcut_manager_unittest_win.cc', |