Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/importer/firefox2_importer.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/i18n/icu_string_conversions.h" 13 #include "base/i18n/icu_string_conversions.h"
13 #include "base/message_loop.h" 14 #include "base/message_loop.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/history/history_types.h" 21 #include "chrome/browser/history/history_types.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 &text16, 0, ASCIIToUTF16("&quot;"), ASCIIToUTF16("\"")); 618 &text16, 0, ASCIIToUTF16("&quot;"), ASCIIToUTF16("\""));
618 ReplaceSubstringsAfterOffset( 619 ReplaceSubstringsAfterOffset(
619 &text16, 0, ASCIIToUTF16("&#39;"), ASCIIToUTF16("\'")); 620 &text16, 0, ASCIIToUTF16("&#39;"), ASCIIToUTF16("\'"));
620 text->assign(text16); 621 text->assign(text16);
621 } 622 }
622 623
623 // static 624 // static
624 void Firefox2Importer::FindXMLFilesInDir( 625 void Firefox2Importer::FindXMLFilesInDir(
625 const base::FilePath& dir, 626 const base::FilePath& dir,
626 std::vector<base::FilePath>* xml_files) { 627 std::vector<base::FilePath>* xml_files) {
627 file_util::FileEnumerator file_enum(dir, false, 628 base::FileEnumerator file_enum(dir, false,
628 file_util::FileEnumerator::FILES, 629 base::FileEnumerator::FILES,
629 FILE_PATH_LITERAL("*.xml")); 630 FILE_PATH_LITERAL("*.xml"));
630 base::FilePath file(file_enum.Next()); 631 base::FilePath file(file_enum.Next());
631 while (!file.empty()) { 632 while (!file.empty()) {
632 xml_files->push_back(file); 633 xml_files->push_back(file);
633 file = file_enum.Next(); 634 file = file_enum.Next();
634 } 635 }
635 } 636 }
636 637
637 // static 638 // static
638 void Firefox2Importer::DataURLToFaviconUsage( 639 void Firefox2Importer::DataURLToFaviconUsage(
639 const GURL& link_url, 640 const GURL& link_url,
(...skipping 17 matching lines...) Expand all
657 658
658 // We need to make up a URL for the favicon. We use a version of the page's 659 // We need to make up a URL for the favicon. We use a version of the page's
659 // URL so that we can be sure it will not collide. 660 // URL so that we can be sure it will not collide.
660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); 661 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec());
661 662
662 // We only have one URL per favicon for Firefox 2 bookmarks. 663 // We only have one URL per favicon for Firefox 2 bookmarks.
663 usage.urls.insert(link_url); 664 usage.urls.insert(link_url);
664 665
665 favicons->push_back(usage); 666 favicons->push_back(usage);
666 } 667 }
OLDNEW
« no previous file with comments | « chrome/browser/history/text_database_manager.cc ('k') | chrome/browser/importer/firefox3_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698