OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_FIREFOX3_IMPORTER_H_ | |
6 #define CHROME_BROWSER_FIREFOX3_IMPORTER_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "chrome/browser/importer.h" | |
14 #include "chrome/common/sqlite_utils.h" | |
15 #include "googleurl/src/gurl.h" | |
16 | |
17 // Importer for Mozilla Firefox 3. | |
18 // Firefox 3 stores its persistent information in a new system called places. | |
19 // http://wiki.mozilla.org/Places | |
20 class Firefox3Importer : public Importer { | |
21 public: | |
22 Firefox3Importer() { } | |
23 virtual ~Firefox3Importer() { } | |
24 | |
25 // Importer methods. | |
26 virtual void StartImport(ProfileInfo profile_info, | |
27 uint16 items, | |
28 ProfileWriter* writer, | |
29 ImporterHost* host); | |
30 | |
31 private: | |
32 typedef std::map<int64, std::set<GURL> > FaviconMap; | |
33 | |
34 void ImportBookmarks(); | |
35 void ImportPasswords(); | |
36 void ImportHistory(); | |
37 void ImportSearchEngines(); | |
38 // Import the user's home page, unless it is set to default home page as | |
39 // defined in browserconfig.properties. | |
40 void ImportHomepage(); | |
41 void GetSearchEnginesXMLFiles(std::vector<std::wstring>* files); | |
42 | |
43 // The struct stores the information about a bookmark item. | |
44 struct BookmarkItem { | |
45 int parent; | |
46 int id; | |
47 GURL url; | |
48 std::wstring title; | |
49 int type; | |
50 std::string keyword; | |
51 Time date_added; | |
52 int64 favicon; | |
53 }; | |
54 typedef std::vector<BookmarkItem*> BookmarkList; | |
55 | |
56 // Gets the specific IDs of bookmark root node from |db|. | |
57 void LoadRootNodeID(sqlite3* db, int* toolbar_folder_id, | |
58 int* menu_folder_id, int* unsorted_folder_id); | |
59 | |
60 // Loads all livemark IDs from database |db|. | |
61 void LoadLivemarkIDs(sqlite3* db, std::set<int>* livemark); | |
62 | |
63 // Gets the bookmark folder with given ID, and adds the entry in |list| | |
64 // if successful. | |
65 void GetTopBookmarkFolder(sqlite3* db, int folder_id, BookmarkList* list); | |
66 | |
67 // Loads all children of the given folder, and appends them to the |list|. | |
68 void GetWholeBookmarkFolder(sqlite3* db, BookmarkList* list, | |
69 size_t position); | |
70 | |
71 // Loads the favicons given in the map from the database, loads the data, | |
72 // and converts it into FaviconUsage structures. | |
73 void LoadFavicons(sqlite3* db, | |
74 const FaviconMap& favicon_map, | |
75 std::vector<history::ImportedFavIconUsage>* favicons); | |
76 | |
77 ProfileWriter* writer_; | |
78 std::wstring source_path_; | |
79 std::wstring app_path_; | |
80 | |
81 DISALLOW_EVIL_CONSTRUCTORS(Firefox3Importer); | |
82 }; | |
83 | |
84 #endif // CHROME_BROWSER_FIREFOX3_IMPORTER_H_ | |
85 | |
OLD | NEW |