| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/importer/firefox_importer_utils.h" | 5 #include "chrome/browser/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 |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // browser.search.selectedEngine does not exist if the user has not changed | 305 // browser.search.selectedEngine does not exist if the user has not changed |
| 306 // from the default (or has selected the default). | 306 // from the default (or has selected the default). |
| 307 // TODO: should fallback to 'browser.search.defaultengine' if selectedEngine | 307 // TODO: should fallback to 'browser.search.defaultengine' if selectedEngine |
| 308 // is empty. | 308 // is empty. |
| 309 return -1; | 309 return -1; |
| 310 } | 310 } |
| 311 | 311 |
| 312 int default_se_index = -1; | 312 int default_se_index = -1; |
| 313 for (std::vector<TemplateURL*>::const_iterator iter = search_engines.begin(); | 313 for (std::vector<TemplateURL*>::const_iterator iter = search_engines.begin(); |
| 314 iter != search_engines.end(); ++iter) { | 314 iter != search_engines.end(); ++iter) { |
| 315 if (default_se_name == WideToUTF8((*iter)->short_name())) { | 315 if (default_se_name == UTF16ToUTF8((*iter)->short_name())) { |
| 316 default_se_index = static_cast<int>(iter - search_engines.begin()); | 316 default_se_index = static_cast<int>(iter - search_engines.begin()); |
| 317 break; | 317 break; |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 if (default_se_index == -1) { | 320 if (default_se_index == -1) { |
| 321 LOG(WARNING) << | 321 LOG(WARNING) << |
| 322 "Firefox default search engine not found in search engine list"; | 322 "Firefox default search engine not found in search engine list"; |
| 323 } | 323 } |
| 324 | 324 |
| 325 return default_se_index; | 325 return default_se_index; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 | 456 |
| 457 // String values have double quotes we don't need to return to the caller. | 457 // String values have double quotes we don't need to return to the caller. |
| 458 if (content[start] == '\"' && content[stop - 1] == '\"') { | 458 if (content[start] == '\"' && content[stop - 1] == '\"') { |
| 459 ++start; | 459 ++start; |
| 460 --stop; | 460 --stop; |
| 461 } | 461 } |
| 462 | 462 |
| 463 return content.substr(start, stop - start); | 463 return content.substr(start, stop - start); |
| 464 } | 464 } |
| OLD | NEW |