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

Unified Diff: chrome/browser/importer/safari_importer.h

Issue 159668: First cut at Safari Import - Home Page & History Only. (Closed)
Patch Set: Fix Stuart's comments. Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/importer/safari_importer.h
diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h
new file mode 100644
index 0000000000000000000000000000000000000000..28b939f3e00e19286c58d1af2762872cd5a0e743
--- /dev/null
+++ b/chrome/browser/importer/safari_importer.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_
+#define CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_
+
+#include "chrome/browser/importer/importer.h"
+
+#if __OBJC__
+@class NSDictionary;
+@class NSString;
+#else
+class NSDictionary;
+class NSString;
+#endif
+
+// Importer for Safari on OS X.
+class SafariImporter : public Importer {
+ public:
+ // |library_dir| is the full path to the ~/Library directory,
+ // We pass it in as a parameter for testing purposes.
+ explicit SafariImporter(const FilePath& library_dir);
+ virtual ~SafariImporter();
+
+ // Importer methods.
+ virtual void StartImport(ProfileInfo profile_info,
+ uint16 items,
+ ProfileWriter* writer,
+ MessageLoop* delegate_loop,
+ ImporterHost* host);
+
+ private:
+ FRIEND_TEST(SafariImporterTest, HistoryImport);
+
+ void ImportBookmarks();
+ void ImportSearchEngines();
+ void ImportPasswords();
+ void ImportHistory();
+ void ImportHomepage();
+
+ // Converts history time stored by Safari as a double serialized as a string,
+ // to seconds-since-UNIX-Ephoch-format used by Chrome.
+ double HistoryTimeToEpochTime(NSString* history_time);
+
+ // Parses Safari's history and loads it into the input array.
+ void ParseHistoryItems(std::vector<history::URLRow>* history_items);
+
+ // Given the URL of a page and a favicon data URL, adds an appropriate record
+ // to the given favicon usage vector. Will do nothing if the favicon is not
+ // valid.
+ static void DataURLToFaviconUsage(
+ const GURL& link_url,
+ const GURL& favicon_data,
+ std::vector<history::ImportedFavIconUsage>* favicons);
+
+ ProfileWriter* writer_;
+ FilePath library_dir_;
+
+ DISALLOW_COPY_AND_ASSIGN(SafariImporter);
+};
+
+#endif // CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_

Powered by Google App Engine
This is Rietveld 408576698