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