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 #ifndef CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ | 5 #ifndef CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ |
6 #define CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ | 6 #define CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Multiple URLs can share the same favicon; this is a map | 54 // Multiple URLs can share the same favicon; this is a map |
55 // of URLs -> IconIDs that we load as a temporary step before | 55 // of URLs -> IconIDs that we load as a temporary step before |
56 // actually loading the icons. | 56 // actually loading the icons. |
57 typedef std::map<int64, std::set<GURL> > FaviconMap; | 57 typedef std::map<int64, std::set<GURL> > FaviconMap; |
58 | 58 |
59 void ImportBookmarks(); | 59 void ImportBookmarks(); |
60 void ImportPasswords(); | 60 void ImportPasswords(); |
61 void ImportHistory(); | 61 void ImportHistory(); |
62 | 62 |
63 // Parse Safari's stored bookmarks. | 63 // Parse Safari's stored bookmarks. |
64 void ParseBookmarks(const string16& toolbar_name, | 64 void ParseBookmarks(const base::string16& toolbar_name, |
65 std::vector<ImportedBookmarkEntry>* bookmarks); | 65 std::vector<ImportedBookmarkEntry>* bookmarks); |
66 | 66 |
67 // Function to recursively read Bookmarks out of Safari plist. | 67 // Function to recursively read Bookmarks out of Safari plist. |
68 // |bookmark_folder| The dictionary containing a folder to parse. | 68 // |bookmark_folder| The dictionary containing a folder to parse. |
69 // |parent_path_elements| Path elements up to this point. | 69 // |parent_path_elements| Path elements up to this point. |
70 // |is_in_toolbar| Is this folder in the toolbar. | 70 // |is_in_toolbar| Is this folder in the toolbar. |
71 // |out_bookmarks| BookMark element array to write into. | 71 // |out_bookmarks| BookMark element array to write into. |
72 void RecursiveReadBookmarksFolder( | 72 void RecursiveReadBookmarksFolder( |
73 NSDictionary* bookmark_folder, | 73 NSDictionary* bookmark_folder, |
74 const std::vector<string16>& parent_path_elements, | 74 const std::vector<base::string16>& parent_path_elements, |
75 bool is_in_toolbar, | 75 bool is_in_toolbar, |
76 const string16& toolbar_name, | 76 const base::string16& toolbar_name, |
77 std::vector<ImportedBookmarkEntry>* out_bookmarks); | 77 std::vector<ImportedBookmarkEntry>* out_bookmarks); |
78 | 78 |
79 // Converts history time stored by Safari as a double serialized as a string, | 79 // Converts history time stored by Safari as a double serialized as a string, |
80 // to seconds-since-UNIX-Ephoch-format used by Chrome. | 80 // to seconds-since-UNIX-Ephoch-format used by Chrome. |
81 double HistoryTimeToEpochTime(NSString* history_time); | 81 double HistoryTimeToEpochTime(NSString* history_time); |
82 | 82 |
83 // Parses Safari's history and loads it into the input array. | 83 // Parses Safari's history and loads it into the input array. |
84 void ParseHistoryItems(std::vector<ImporterURLRow>* history_items); | 84 void ParseHistoryItems(std::vector<ImporterURLRow>* history_items); |
85 | 85 |
86 // Opens the favicon database file. | 86 // Opens the favicon database file. |
87 bool OpenDatabase(sql::Connection* db); | 87 bool OpenDatabase(sql::Connection* db); |
88 | 88 |
89 // Loads the urls associated with the favicons into favicon_map; | 89 // Loads the urls associated with the favicons into favicon_map; |
90 void ImportFaviconURLs(sql::Connection* db, FaviconMap* favicon_map); | 90 void ImportFaviconURLs(sql::Connection* db, FaviconMap* favicon_map); |
91 | 91 |
92 // Loads and reencodes the individual favicons. | 92 // Loads and reencodes the individual favicons. |
93 void LoadFaviconData(sql::Connection* db, | 93 void LoadFaviconData(sql::Connection* db, |
94 const FaviconMap& favicon_map, | 94 const FaviconMap& favicon_map, |
95 std::vector<ImportedFaviconUsage>* favicons); | 95 std::vector<ImportedFaviconUsage>* favicons); |
96 | 96 |
97 base::FilePath library_dir_; | 97 base::FilePath library_dir_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(SafariImporter); | 99 DISALLOW_COPY_AND_ASSIGN(SafariImporter); |
100 }; | 100 }; |
101 | 101 |
102 #endif // CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ | 102 #endif // CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_ |
OLD | NEW |