OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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_IMPORTER_SAFARI_IMPORTER_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ |
| 7 |
| 8 #include "chrome/browser/importer/importer.h" |
| 9 |
| 10 #if __OBJC__ |
| 11 @class NSDictionary; |
| 12 @class NSString; |
| 13 #else |
| 14 class NSDictionary; |
| 15 class NSString; |
| 16 #endif |
| 17 |
| 18 // Importer for Safari on OS X. |
| 19 class SafariImporter : public Importer { |
| 20 public: |
| 21 // |library_dir| is the full path to the ~/Library directory, |
| 22 // We pass it in as a parameter for testing purposes. |
| 23 explicit SafariImporter(const FilePath& library_dir); |
| 24 virtual ~SafariImporter(); |
| 25 |
| 26 // Importer methods. |
| 27 virtual void StartImport(ProfileInfo profile_info, |
| 28 uint16 items, |
| 29 ProfileWriter* writer, |
| 30 MessageLoop* delegate_loop, |
| 31 ImporterHost* host); |
| 32 |
| 33 private: |
| 34 FRIEND_TEST(SafariImporterTest, HistoryImport); |
| 35 |
| 36 void ImportBookmarks(); |
| 37 void ImportSearchEngines(); |
| 38 void ImportPasswords(); |
| 39 void ImportHistory(); |
| 40 void ImportHomepage(); |
| 41 |
| 42 // Converts history time stored by Safari as a double serialized as a string, |
| 43 // to seconds-since-UNIX-Ephoch-format used by Chrome. |
| 44 double HistoryTimeToEpochTime(NSString* history_time); |
| 45 |
| 46 // Parses Safari's history and loads it into the input array. |
| 47 void ParseHistoryItems(std::vector<history::URLRow>* history_items); |
| 48 |
| 49 // Given the URL of a page and a favicon data URL, adds an appropriate record |
| 50 // to the given favicon usage vector. Will do nothing if the favicon is not |
| 51 // valid. |
| 52 static void DataURLToFaviconUsage( |
| 53 const GURL& link_url, |
| 54 const GURL& favicon_data, |
| 55 std::vector<history::ImportedFavIconUsage>* favicons); |
| 56 |
| 57 ProfileWriter* writer_; |
| 58 FilePath library_dir_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(SafariImporter); |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ |
OLD | NEW |