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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 IDS_LOGIN_DEFAULT_USER_DESC_32, | 69 IDS_LOGIN_DEFAULT_USER_DESC_32, |
70 }; | 70 }; |
71 | 71 |
72 // Returns a string consisting of the prefix specified and the index of the | 72 // Returns a string consisting of the prefix specified and the index of the |
73 // image if its valid. | 73 // image if its valid. |
74 std::string GetDefaultImageString(int index, const std::string& prefix) { | 74 std::string GetDefaultImageString(int index, const std::string& prefix) { |
75 if (index < 0 || index >= kDefaultImagesCount) { | 75 if (index < 0 || index >= kDefaultImagesCount) { |
76 NOTREACHED(); | 76 NOTREACHED(); |
77 return std::string(); | 77 return std::string(); |
78 } | 78 } |
79 return StringPrintf("%s%d", prefix.c_str(), index); | 79 return base::StringPrintf("%s%d", prefix.c_str(), index); |
80 } | 80 } |
81 | 81 |
82 // Returns true if the string specified consists of the prefix and one of | 82 // Returns true if the string specified consists of the prefix and one of |
83 // the default images indices. Returns the index of the image in |image_id| | 83 // the default images indices. Returns the index of the image in |image_id| |
84 // variable. | 84 // variable. |
85 bool IsDefaultImageString(const std::string& s, | 85 bool IsDefaultImageString(const std::string& s, |
86 const std::string& prefix, | 86 const std::string& prefix, |
87 int* image_id) { | 87 int* image_id) { |
88 DCHECK(image_id); | 88 DCHECK(image_id); |
89 if (!StartsWithASCII(s, prefix, true)) | 89 if (!StartsWithASCII(s, prefix, true)) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 int GetDefaultImageHistogramValue(int index) { | 276 int GetDefaultImageHistogramValue(int index) { |
277 DCHECK(index >= 0 && index < kDefaultImagesCount); | 277 DCHECK(index >= 0 && index < kDefaultImagesCount); |
278 // Create a gap in histogram values for | 278 // Create a gap in histogram values for |
279 // [kHistogramImageFromCamera..kHistogramImageFromProfile] block to fit. | 279 // [kHistogramImageFromCamera..kHistogramImageFromProfile] block to fit. |
280 if (index < kHistogramImageFromCamera) | 280 if (index < kHistogramImageFromCamera) |
281 return index; | 281 return index; |
282 return index + 6; | 282 return index + 6; |
283 } | 283 } |
284 | 284 |
285 } // namespace chromeos | 285 } // namespace chromeos |
OLD | NEW |