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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_icon_source.cc

Issue 1240183002: Update SplitString calls in chrome. (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 (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/ui/webui/extensions/extension_icon_source.h" 5 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 else 271 else
272 LoadDefaultImage(request_id); 272 LoadDefaultImage(request_id);
273 } 273 }
274 274
275 bool ExtensionIconSource::ParseData( 275 bool ExtensionIconSource::ParseData(
276 const std::string& path, 276 const std::string& path,
277 int request_id, 277 int request_id,
278 const content::URLDataSource::GotDataCallback& callback) { 278 const content::URLDataSource::GotDataCallback& callback) {
279 // Extract the parameters from the path by lower casing and splitting. 279 // Extract the parameters from the path by lower casing and splitting.
280 std::string path_lower = base::StringToLowerASCII(path); 280 std::string path_lower = base::StringToLowerASCII(path);
281 std::vector<std::string> path_parts; 281 std::vector<std::string> path_parts = base::SplitString(
282 282 path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
283 base::SplitString(path_lower, '/', &path_parts);
284 if (path_lower.empty() || path_parts.size() < 3) 283 if (path_lower.empty() || path_parts.size() < 3)
285 return false; 284 return false;
286 285
287 std::string size_param = path_parts.at(1); 286 std::string size_param = path_parts.at(1);
288 std::string match_param = path_parts.at(2); 287 std::string match_param = path_parts.at(2);
289 match_param = match_param.substr(0, match_param.find('?')); 288 match_param = match_param.substr(0, match_param.find('?'));
290 289
291 int size; 290 int size;
292 if (!base::StringToInt(size_param, &size)) 291 if (!base::StringToInt(size_param, &size))
293 return false; 292 return false;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 std::map<int, ExtensionIconRequest*>::iterator i = 341 std::map<int, ExtensionIconRequest*>::iterator i =
343 request_map_.find(request_id); 342 request_map_.find(request_id);
344 if (i == request_map_.end()) 343 if (i == request_map_.end())
345 return; 344 return;
346 345
347 delete i->second; 346 delete i->second;
348 request_map_.erase(i); 347 request_map_.erase(i);
349 } 348 }
350 349
351 } // namespace extensions 350 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698