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

Side by Side Diff: chrome/common/importer/firefox_importer_utils.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 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/common/importer/firefox_importer_utils.h" 5 #include "chrome/common/importer/firefox_importer_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 std::string content; 304 std::string content;
305 base::ReadFileToString(app_ini_file, &content); 305 base::ReadFileToString(app_ini_file, &content);
306 306
307 const std::string name_attr("Name="); 307 const std::string name_attr("Name=");
308 bool in_app_section = false; 308 bool in_app_section = false;
309 for (const base::StringPiece& line : base::SplitStringPiece( 309 for (const base::StringPiece& line : base::SplitStringPiece(
310 content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { 310 content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
311 if (line == "[App]") { 311 if (line == "[App]") {
312 in_app_section = true; 312 in_app_section = true;
313 } else if (in_app_section) { 313 } else if (in_app_section) {
314 if (line.find(name_attr) == 0) { 314 if (base::StartsWith(line, name_attr, base::CompareCase::SENSITIVE)) {
315 line.substr(name_attr.size()).CopyToString(&branding_name); 315 line.substr(name_attr.size()).CopyToString(&branding_name);
316 break; 316 break;
317 } else if (line.length() > 0 && line[0] == '[') { 317 }
318 if (line.length() > 0 && line[0] == '[') {
318 // No longer in the [App] section. 319 // No longer in the [App] section.
319 break; 320 break;
320 } 321 }
321 } 322 }
322 } 323 }
323 } 324 }
324 325
325 branding_name = base::ToLowerASCII(branding_name); 326 branding_name = base::ToLowerASCII(branding_name);
326 if (branding_name.find("iceweasel") != std::string::npos) 327 if (branding_name.find("iceweasel") != std::string::npos)
327 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); 328 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL);
328 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); 329 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX);
329 } 330 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | chrome/renderer/pepper/pepper_uma_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698