Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: chrome/browser/chromeos/login/default_user_images.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_piece.h"
10 #include "base/string_util.h" 11 #include "base/string_util.h"
11 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
12 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 namespace { 19 namespace {
19 20
(...skipping 23 matching lines...) Expand all
43 // the default images indices. Returns the index of the image in |image_id| 44 // the default images indices. Returns the index of the image in |image_id|
44 // variable. 45 // variable.
45 bool IsDefaultImageString(const std::string& s, 46 bool IsDefaultImageString(const std::string& s,
46 const std::string& prefix, 47 const std::string& prefix,
47 int* image_id) { 48 int* image_id) {
48 DCHECK(image_id); 49 DCHECK(image_id);
49 if (!StartsWithASCII(s, prefix, true)) 50 if (!StartsWithASCII(s, prefix, true))
50 return false; 51 return false;
51 52
52 int image_index = -1; 53 int image_index = -1;
53 if (base::StringToInt(s.begin() + prefix.length(), 54 if (base::StringToInt(base::StringPiece(s.begin() + prefix.length(),
54 s.end(), 55 s.end()),
55 &image_index)) { 56 &image_index)) {
56 if (image_index < 0 || image_index >= kDefaultImagesCount) 57 if (image_index < 0 || image_index >= kDefaultImagesCount)
57 return false; 58 return false;
58 *image_id = image_index; 59 *image_id = image_index;
59 return true; 60 return true;
60 } 61 }
61 62
62 return false; 63 return false;
63 } 64 }
64 } // namespace 65 } // namespace
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 129
129 // The order and the values of these constants are important for histograms 130 // The order and the values of these constants are important for histograms
130 // of different Chrome OS versions to be merged smoothly. 131 // of different Chrome OS versions to be merged smoothly.
131 const int kHistogramImageFromCamera = kDefaultImagesCount; 132 const int kHistogramImageFromCamera = kDefaultImagesCount;
132 const int kHistogramImageFromFile = kDefaultImagesCount + 1; 133 const int kHistogramImageFromFile = kDefaultImagesCount + 1;
133 const int kHistogramImageOld = kDefaultImagesCount + 2; 134 const int kHistogramImageOld = kDefaultImagesCount + 2;
134 const int kHistogramImageFromProfile = kDefaultImagesCount + 3; 135 const int kHistogramImageFromProfile = kDefaultImagesCount + 3;
135 const int kHistogramImagesCount = kDefaultImagesCount + 4; 136 const int kHistogramImagesCount = kDefaultImagesCount + 4;
136 137
137 } // namespace chromeos 138 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete_history_manager.cc ('k') | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698