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

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

Issue 14575004: Extract BookmarksFileImporter from Firefox2Importer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix again 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) 2011 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 #ifndef CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ 5 #ifndef CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_
6 #define CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ 6 #define CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "chrome/browser/importer/importer.h" 15 #include "chrome/browser/importer/importer.h"
16 #include "chrome/browser/importer/profile_writer.h"
17 16
18 class GURL; 17 class GURL;
18 struct ImportedBookmarkEntry;
19 class TemplateURL; 19 class TemplateURL;
20 20
21 namespace base {
22 class Time;
23 }
24
25 namespace history {
26 struct ImportedFaviconUsage;
27 }
28
21 // Importer for Mozilla Firefox 2. 29 // Importer for Mozilla Firefox 2.
22 class Firefox2Importer : public Importer { 30 class Firefox2Importer : public Importer {
23 public: 31 public:
24 Firefox2Importer(); 32 Firefox2Importer();
25 33
26 // Importer: 34 // Importer:
27 virtual void StartImport(const importer::SourceProfile& source_profile, 35 virtual void StartImport(const importer::SourceProfile& source_profile,
28 uint16 items, 36 uint16 items,
29 ImporterBridge* bridge) OVERRIDE; 37 ImporterBridge* bridge) OVERRIDE;
30 38
31 // Loads the default bookmarks in the Firefox installed at |firefox_app_path|, 39 // Loads the default bookmarks in the Firefox installed at |firefox_app_path|,
32 // and stores their locations in |urls|. 40 // and stores their locations in |urls|.
33 static void LoadDefaultBookmarks(const base::FilePath& firefox_app_path, 41 static void LoadDefaultBookmarks(const base::FilePath& firefox_app_path,
34 std::set<GURL>* urls); 42 std::set<GURL>* urls);
35 43
36 // Creates a TemplateURL with the |keyword| and |url|. |title| may be empty. 44 // Creates a TemplateURL with the |keyword| and |url|. |title| may be empty.
37 // This function transfers ownership of the created TemplateURL to the caller. 45 // This function transfers ownership of the created TemplateURL to the caller.
38 static TemplateURL* CreateTemplateURL(const string16& title, 46 static TemplateURL* CreateTemplateURL(const string16& title,
39 const string16& keyword, 47 const string16& keyword,
40 const GURL& url); 48 const GURL& url);
41 49
42 // Imports the bookmarks from the specified file. |template_urls| and 50 // Imports the bookmarks from the specified file. |template_urls| and
43 // |favicons| may be null, in which case TemplateURLs and favicons are 51 // |favicons| may be null, in which case TemplateURLs and favicons are
44 // not parsed. Any bookmarks in |default_urls| are ignored. 52 // not parsed. Any bookmarks in |default_urls| are ignored.
45 static void ImportBookmarksFile( 53 static void ImportBookmarksFile(
46 const base::FilePath& file_path, 54 const base::FilePath& file_path,
47 const std::set<GURL>& default_urls, 55 const std::set<GURL>& default_urls,
48 Importer* importer, 56 Importer* importer,
49 std::vector<ProfileWriter::BookmarkEntry>* bookmarks, 57 std::vector<ImportedBookmarkEntry>* bookmarks,
50 std::vector<TemplateURL*>* template_urls, 58 std::vector<TemplateURL*>* template_urls,
51 std::vector<history::ImportedFaviconUsage>* favicons); 59 std::vector<history::ImportedFaviconUsage>* favicons);
52 60
53 private: 61 private:
54 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2BookmarkParse); 62 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2BookmarkParse);
55 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2CookesParse); 63 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2CookesParse);
56 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2BookmarkFileImport); 64 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, Firefox2BookmarkFileImport);
57 65
58 virtual ~Firefox2Importer(); 66 virtual ~Firefox2Importer();
59 67
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 145
138 base::FilePath source_path_; 146 base::FilePath source_path_;
139 base::FilePath app_path_; 147 base::FilePath app_path_;
140 // If true, we only parse the bookmarks.html file specified as source_path_. 148 // If true, we only parse the bookmarks.html file specified as source_path_.
141 bool parsing_bookmarks_html_file_; 149 bool parsing_bookmarks_html_file_;
142 150
143 DISALLOW_COPY_AND_ASSIGN(Firefox2Importer); 151 DISALLOW_COPY_AND_ASSIGN(Firefox2Importer);
144 }; 152 };
145 153
146 #endif // CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ 154 #endif // CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698