15f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// found in the LICENSE file.
45f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "components/user_manager/user_image/default_user_images.h"
65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
75f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/basictypes.h"
85f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/logging.h"
95f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/strings/string_number_conversions.h"
105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/strings/string_piece.h"
115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/strings/string_util.h"
125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/strings/stringprintf.h"
135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/sys_info.h"
145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "grit/ui_chromeos_resources.h"
155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "grit/ui_chromeos_strings.h"
165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/base/l10n/l10n_util.h"
175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/base/resource/resource_bundle.h"
185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/gfx/image/image_skia.h"
195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace user_manager {
215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace {
235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const char kDefaultUrlPrefix[] = "chrome://theme/IDR_LOGIN_DEFAULT_USER_";
255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const char kZeroDefaultUrl[] = "chrome://theme/IDR_LOGIN_DEFAULT_USER";
265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// IDs of default user image descriptions.
285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kDefaultImageDescriptions[] = {
295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 0.
305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 1.
315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 2.
325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 3.
335f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 4.
345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 5.
355f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 6.
365f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 7.
375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 8.
385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 9.
395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 10.
405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 11.
415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 12.
425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 13.
435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 14.
445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 15.
455f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 16.
465f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 17.
475f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    0,  // No description for deprecated user image 18.
485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_19,
495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_20,
505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_21,
515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_22,
525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_23,
535f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_24,
545f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_25,
555f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_26,
565f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_27,
575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_28,
585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_29,
595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_30,
605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_31,
615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_DESC_32,
625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)};
635f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Returns a string consisting of the prefix specified and the index of the
655f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// image if its valid.
665f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)std::string GetDefaultImageString(int index, const std::string& prefix) {
675f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (index < 0 || index >= kDefaultImagesCount) {
685f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    DCHECK(!base::SysInfo::IsRunningOnChromeOS());
695f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return std::string();
705f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  }
715f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return base::StringPrintf("%s%d", prefix.c_str(), index);
725f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
735f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Returns true if the string specified consists of the prefix and one of
755f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// the default images indices. Returns the index of the image in |image_id|
765f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// variable.
775f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)bool IsDefaultImageString(const std::string& s,
785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                          const std::string& prefix,
795f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                          int* image_id) {
805f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  DCHECK(image_id);
815f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (!StartsWithASCII(s, prefix, true))
825f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return false;
835f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
845f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  int image_index = -1;
855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (base::StringToInt(base::StringPiece(s.begin() + prefix.length(), s.end()),
865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                        &image_index)) {
875f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    if (image_index < 0 || image_index >= kDefaultImagesCount)
885f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      return false;
895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    *image_id = image_index;
905f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return true;
915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  }
925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return false;
945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
955f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace
965f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
975f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)std::string GetDefaultImageUrl(int index) {
985f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (index == 0)
995f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return kZeroDefaultUrl;
1005f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return GetDefaultImageString(index, kDefaultUrlPrefix);
1015f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
1025f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1035f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)bool IsDefaultImageUrl(const std::string& url, int* image_id) {
1045f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (url == kZeroDefaultUrl) {
1055f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    *image_id = 0;
1065f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return true;
1075f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  }
1085f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return IsDefaultImageString(url, kDefaultUrlPrefix, image_id);
1095f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
1105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const gfx::ImageSkia& GetDefaultImage(int index) {
1125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  DCHECK(index >= 0 && index < kDefaultImagesCount);
1135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
1145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      kDefaultImageResourceIDs[index]);
1155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
1165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)base::string16 GetDefaultImageDescription(int index) {
1185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  DCHECK(index >= 0 && index < kDefaultImagesCount);
1195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  int string_id = kDefaultImageDescriptions[index];
1205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (string_id)
1215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return l10n_util::GetStringUTF16(string_id);
1225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  else
1235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return base::string16();
1245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
1255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Resource IDs of default user images.
1275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kDefaultImageResourceIDs[] = {
1285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER,
1295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_1,
1305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_2,
1315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_3,
1325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_4,
1335f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_5,
1345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_6,
1355f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_7,
1365f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_8,
1375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_9,
1385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_10,
1395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_11,
1405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_12,
1415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_13,
1425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_14,
1435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_15,
1445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_16,
1455f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_17,
1465f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_18,
1475f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_19,
1485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_20,
1495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_21,
1505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_22,
1515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_23,
1525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_24,
1535f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_25,
1545f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_26,
1555f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_27,
1565f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_28,
1575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_29,
1585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_30,
1595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_31,
1605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDR_LOGIN_DEFAULT_USER_32,
1615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)};
1625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1635f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kDefaultImageAuthorIDs[] = {
1645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR,
1655f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_1,
1665f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_2,
1675f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_3,
1685f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_4,
1695f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_5,
1705f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_6,
1715f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_7,
1725f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_8,
1735f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_9,
1745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_10,
1755f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_11,
1765f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_12,
1775f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_13,
1785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_14,
1795f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_15,
1805f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_16,
1815f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_17,
1825f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_18,
1835f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_19,
1845f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_20,
1855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_21,
1865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_22,
1875f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_23,
1885f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_24,
1895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_25,
1905f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_26,
1915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_27,
1925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_28,
1935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_29,
1945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_30,
1955f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_31,
1965f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_AUTHOR_32,
1975f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)};
1985f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
1995f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kDefaultImageWebsiteIDs[] = {
2005f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE,
2015f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_1,
2025f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_2,
2035f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_3,
2045f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_4,
2055f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_5,
2065f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_6,
2075f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_7,
2085f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_8,
2095f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_9,
2105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_10,
2115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_11,
2125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_12,
2135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_13,
2145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_14,
2155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_15,
2165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_16,
2175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_17,
2185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_18,
2195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_19,
2205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_20,
2215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_21,
2225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_22,
2235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_23,
2245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_24,
2255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_25,
2265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_26,
2275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_27,
2285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_28,
2295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_29,
2305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_30,
2315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_31,
2325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    IDS_LOGIN_DEFAULT_USER_WEBSITE_32,
2335f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)};
2345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2355f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kDefaultImagesCount = arraysize(kDefaultImageResourceIDs);
2365f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kFirstDefaultImageIndex = 19;
2385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// The order and the values of these constants are important for histograms
2405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// of different Chrome OS versions to be merged smoothly.
2415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramImageFromCamera = 19;
2425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramImageFromFile = 20;
2435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramImageOld = 21;
2445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramImageFromProfile = 22;
2455f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramVideoFromCamera = 23;
2465f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramVideoFromFile = 24;
2475f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)const int kHistogramImagesCount = kDefaultImagesCount + 6;
2485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)int GetDefaultImageHistogramValue(int index) {
2505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  DCHECK(index >= 0 && index < kDefaultImagesCount);
2515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // Create a gap in histogram values for
2525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // [kHistogramImageFromCamera..kHistogramImageFromProfile] block to fit.
2535f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (index < kHistogramImageFromCamera)
2545f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return index;
2555f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return index + 6;
2565f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
2575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace user_manager
259