OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/default_user_images.h" | 5 #include "chrome/browser/chromeos/login/default_user_images.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/chromeos/chromeos_version.h" | |
9 #include "base/logging.h" | 8 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
12 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/sys_info.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 IDS_LOGIN_DEFAULT_USER_DESC_29, | 67 IDS_LOGIN_DEFAULT_USER_DESC_29, |
68 IDS_LOGIN_DEFAULT_USER_DESC_30, | 68 IDS_LOGIN_DEFAULT_USER_DESC_30, |
69 IDS_LOGIN_DEFAULT_USER_DESC_31, | 69 IDS_LOGIN_DEFAULT_USER_DESC_31, |
70 IDS_LOGIN_DEFAULT_USER_DESC_32, | 70 IDS_LOGIN_DEFAULT_USER_DESC_32, |
71 }; | 71 }; |
72 | 72 |
73 // Returns a string consisting of the prefix specified and the index of the | 73 // Returns a string consisting of the prefix specified and the index of the |
74 // image if its valid. | 74 // image if its valid. |
75 std::string GetDefaultImageString(int index, const std::string& prefix) { | 75 std::string GetDefaultImageString(int index, const std::string& prefix) { |
76 if (index < 0 || index >= kDefaultImagesCount) { | 76 if (index < 0 || index >= kDefaultImagesCount) { |
77 DCHECK(!base::chromeos::IsRunningOnChromeOS()); | 77 DCHECK(!base::SysInfo::IsRunningOnChromeOS()); |
78 return std::string(); | 78 return std::string(); |
79 } | 79 } |
80 return base::StringPrintf("%s%d", prefix.c_str(), index); | 80 return base::StringPrintf("%s%d", prefix.c_str(), index); |
81 } | 81 } |
82 | 82 |
83 // Returns true if the string specified consists of the prefix and one of | 83 // Returns true if the string specified consists of the prefix and one of |
84 // the default images indices. Returns the index of the image in |image_id| | 84 // the default images indices. Returns the index of the image in |image_id| |
85 // variable. | 85 // variable. |
86 bool IsDefaultImageString(const std::string& s, | 86 bool IsDefaultImageString(const std::string& s, |
87 const std::string& prefix, | 87 const std::string& prefix, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 int GetDefaultImageHistogramValue(int index) { | 277 int GetDefaultImageHistogramValue(int index) { |
278 DCHECK(index >= 0 && index < kDefaultImagesCount); | 278 DCHECK(index >= 0 && index < kDefaultImagesCount); |
279 // Create a gap in histogram values for | 279 // Create a gap in histogram values for |
280 // [kHistogramImageFromCamera..kHistogramImageFromProfile] block to fit. | 280 // [kHistogramImageFromCamera..kHistogramImageFromProfile] block to fit. |
281 if (index < kHistogramImageFromCamera) | 281 if (index < kHistogramImageFromCamera) |
282 return index; | 282 return index; |
283 return index + 6; | 283 return index + 6; |
284 } | 284 } |
285 | 285 |
286 } // namespace chromeos | 286 } // namespace chromeos |
OLD | NEW |