| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 const base::FilePath app_ini_file = app_path.AppendASCII("application.ini"); | 300 const base::FilePath app_ini_file = app_path.AppendASCII("application.ini"); |
| 301 std::string branding_name; | 301 std::string branding_name; |
| 302 if (base::PathExists(app_ini_file)) { | 302 if (base::PathExists(app_ini_file)) { |
| 303 std::string content; | 303 std::string content; |
| 304 base::ReadFileToString(app_ini_file, &content); | 304 base::ReadFileToString(app_ini_file, &content); |
| 305 std::vector<std::string> lines; | 305 std::vector<std::string> lines; |
| 306 base::SplitString(content, '\n', &lines); | 306 base::SplitString(content, '\n', &lines); |
| 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 (size_t i = 0; i < lines.size(); ++i) { | 309 for (size_t i = 0; i < lines.size(); ++i) { |
| 310 TrimWhitespace(lines[i], TRIM_ALL, &lines[i]); | 310 base::TrimWhitespace(lines[i], base::TRIM_ALL, &lines[i]); |
| 311 if (lines[i] == "[App]") { | 311 if (lines[i] == "[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 (lines[i].find(name_attr) == 0) { | 314 if (lines[i].find(name_attr) == 0) { |
| 315 branding_name = lines[i].substr(name_attr.size()); | 315 branding_name = lines[i].substr(name_attr.size()); |
| 316 break; | 316 break; |
| 317 } else if (lines[i].length() > 0 && lines[i][0] == '[') { | 317 } else if (lines[i].length() > 0 && lines[i][0] == '[') { |
| 318 // No longer in the [App] section. | 318 // No longer in the [App] section. |
| 319 break; | 319 break; |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 StringToLowerASCII(&branding_name); | 325 StringToLowerASCII(&branding_name); |
| 326 if (branding_name.find("iceweasel") != std::string::npos) | 326 if (branding_name.find("iceweasel") != std::string::npos) |
| 327 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); | 327 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); |
| 328 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); | 328 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); |
| 329 } | 329 } |
| OLD | NEW |