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/browser/importer/firefox3_importer.h" | 5 #include "chrome/browser/importer/firefox3_importer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 #if defined(OS_POSIX) | 425 #if defined(OS_POSIX) |
426 // Ubuntu-flavored Firefox3 supports locale-specific search engines via | 426 // Ubuntu-flavored Firefox3 supports locale-specific search engines via |
427 // locale-named subdirectories. They fall back to en-US. | 427 // locale-named subdirectories. They fall back to en-US. |
428 // See http://crbug.com/53899 | 428 // See http://crbug.com/53899 |
429 // TODO(jshin): we need to make sure our locale code matches that of | 429 // TODO(jshin): we need to make sure our locale code matches that of |
430 // Firefox. | 430 // Firefox. |
431 DCHECK(!locale_.empty()); | 431 DCHECK(!locale_.empty()); |
432 base::FilePath locale_app_path = app_path.AppendASCII(locale_); | 432 base::FilePath locale_app_path = app_path.AppendASCII(locale_); |
433 base::FilePath default_locale_app_path = app_path.AppendASCII("en-US"); | 433 base::FilePath default_locale_app_path = app_path.AppendASCII("en-US"); |
434 if (file_util::DirectoryExists(locale_app_path)) | 434 if (base::DirectoryExists(locale_app_path)) |
435 app_path = locale_app_path; | 435 app_path = locale_app_path; |
436 else if (file_util::DirectoryExists(default_locale_app_path)) | 436 else if (base::DirectoryExists(default_locale_app_path)) |
437 app_path = default_locale_app_path; | 437 app_path = default_locale_app_path; |
438 #endif | 438 #endif |
439 | 439 |
440 // Get search engine definition from file system. | 440 // Get search engine definition from file system. |
441 base::FileEnumerator engines(app_path, false, base::FileEnumerator::FILES); | 441 base::FileEnumerator engines(app_path, false, base::FileEnumerator::FILES); |
442 for (base::FilePath engine_path = engines.Next(); | 442 for (base::FilePath engine_path = engines.Next(); |
443 !engine_path.value().empty(); engine_path = engines.Next()) { | 443 !engine_path.value().empty(); engine_path = engines.Next()) { |
444 std::string file_data; | 444 std::string file_data; |
445 file_util::ReadFileToString(file, &file_data); | 445 file_util::ReadFileToString(file, &file_data); |
446 search_engine_data->push_back(file_data); | 446 search_engine_data->push_back(file_data); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 if (!ReencodeFavicon(&data[0], data.size(), &usage.png_data)) | 583 if (!ReencodeFavicon(&data[0], data.size(), &usage.png_data)) |
584 continue; // Unable to decode. | 584 continue; // Unable to decode. |
585 | 585 |
586 usage.urls = i->second; | 586 usage.urls = i->second; |
587 favicons->push_back(usage); | 587 favicons->push_back(usage); |
588 } | 588 } |
589 s.Reset(true); | 589 s.Reset(true); |
590 } | 590 } |
591 } | 591 } |
OLD | NEW |