| 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/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 Loading... |
| 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 } |
| OLD | NEW |