| 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/firefox2_importer.h" | 5 #include "chrome/browser/importer/firefox2_importer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/file_enumerator.h" | |
| 12 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 13 #include "base/i18n/icu_string_conversions.h" | 12 #include "base/i18n/icu_string_conversions.h" |
| 14 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 15 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 18 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 20 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 21 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 &text16, 0, ASCIIToUTF16("""), ASCIIToUTF16("\"")); | 617 &text16, 0, ASCIIToUTF16("""), ASCIIToUTF16("\"")); |
| 619 ReplaceSubstringsAfterOffset( | 618 ReplaceSubstringsAfterOffset( |
| 620 &text16, 0, ASCIIToUTF16("'"), ASCIIToUTF16("\'")); | 619 &text16, 0, ASCIIToUTF16("'"), ASCIIToUTF16("\'")); |
| 621 text->assign(text16); | 620 text->assign(text16); |
| 622 } | 621 } |
| 623 | 622 |
| 624 // static | 623 // static |
| 625 void Firefox2Importer::FindXMLFilesInDir( | 624 void Firefox2Importer::FindXMLFilesInDir( |
| 626 const base::FilePath& dir, | 625 const base::FilePath& dir, |
| 627 std::vector<base::FilePath>* xml_files) { | 626 std::vector<base::FilePath>* xml_files) { |
| 628 base::FileEnumerator file_enum(dir, false, | 627 file_util::FileEnumerator file_enum(dir, false, |
| 629 base::FileEnumerator::FILES, | 628 file_util::FileEnumerator::FILES, |
| 630 FILE_PATH_LITERAL("*.xml")); | 629 FILE_PATH_LITERAL("*.xml")); |
| 631 base::FilePath file(file_enum.Next()); | 630 base::FilePath file(file_enum.Next()); |
| 632 while (!file.empty()) { | 631 while (!file.empty()) { |
| 633 xml_files->push_back(file); | 632 xml_files->push_back(file); |
| 634 file = file_enum.Next(); | 633 file = file_enum.Next(); |
| 635 } | 634 } |
| 636 } | 635 } |
| 637 | 636 |
| 638 // static | 637 // static |
| 639 void Firefox2Importer::DataURLToFaviconUsage( | 638 void Firefox2Importer::DataURLToFaviconUsage( |
| 640 const GURL& link_url, | 639 const GURL& link_url, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 658 | 657 |
| 659 // We need to make up a URL for the favicon. We use a version of the page's | 658 // We need to make up a URL for the favicon. We use a version of the page's |
| 660 // URL so that we can be sure it will not collide. | 659 // URL so that we can be sure it will not collide. |
| 661 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
| 662 | 661 |
| 663 // We only have one URL per favicon for Firefox 2 bookmarks. | 662 // We only have one URL per favicon for Firefox 2 bookmarks. |
| 664 usage.urls.insert(link_url); | 663 usage.urls.insert(link_url); |
| 665 | 664 |
| 666 favicons->push_back(usage); | 665 favicons->push_back(usage); |
| 667 } | 666 } |
| OLD | NEW |