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

Side by Side Diff: components/favicon_base/fallback_icon_url_parser.cc

Issue 1234973004: Update SplitString calls in components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/favicon_base/fallback_icon_url_parser.h" 5 #include "components/favicon_base/fallback_icon_url_parser.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 // static 69 // static
70 bool ParsedFallbackIconPath::ParseSpecs( 70 bool ParsedFallbackIconPath::ParseSpecs(
71 const std::string& specs_str, 71 const std::string& specs_str,
72 int *size, 72 int *size,
73 favicon_base::FallbackIconStyle* style) { 73 favicon_base::FallbackIconStyle* style) {
74 DCHECK(size); 74 DCHECK(size);
75 DCHECK(style); 75 DCHECK(style);
76 76
77 std::vector<std::string> tokens; 77 std::vector<std::string> tokens = base::SplitString(
78 base::SplitStringDontTrim(specs_str, ',', &tokens); 78 specs_str, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
79 if (tokens.size() != 5) // Force "," for empty fields. 79 if (tokens.size() != 5) // Force "," for empty fields.
80 return false; 80 return false;
81 81
82 *size = gfx::kFaviconSize; 82 *size = gfx::kFaviconSize;
83 if (!tokens[0].empty() && !base::StringToInt(tokens[0], size)) 83 if (!tokens[0].empty() && !base::StringToInt(tokens[0], size))
84 return false; 84 return false;
85 if (*size <= 0) 85 if (*size <= 0)
86 return false; 86 return false;
87 87
88 if (!tokens[1].empty() && !ParseColor(tokens[1], &style->background_color)) 88 if (!tokens[1].empty() && !ParseColor(tokens[1], &style->background_color))
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SkColor temp_color = SK_ColorWHITE; 128 SkColor temp_color = SK_ColorWHITE;
129 const char* end = SkParse::FindColor(color_str.c_str(), &temp_color); 129 const char* end = SkParse::FindColor(color_str.c_str(), &temp_color);
130 if (end && !*end) { // Successful if call succeeds and string is consumed. 130 if (end && !*end) { // Successful if call succeeds and string is consumed.
131 *color = temp_color; 131 *color = temp_color;
132 return true; 132 return true;
133 } 133 }
134 return false; 134 return false;
135 } 135 }
136 136
137 } // namespace chrome 137 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698