summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/safari_importer.h
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 20:18:49 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 20:18:49 +0000
commit4dfae51bf8db229251104bc71ae14237a5989e1c (patch)
tree9b68c5d3803d389dbb84edd36d9b1e4f5afded03 /chrome/browser/importer/safari_importer.h
parentcb69ca0e206805c4a4a4cdef2db44fb196820c2a (diff)
downloadchromium_src-4dfae51bf8db229251104bc71ae14237a5989e1c.zip
chromium_src-4dfae51bf8db229251104bc71ae14237a5989e1c.tar.gz
chromium_src-4dfae51bf8db229251104bc71ae14237a5989e1c.tar.bz2
First cut at Safari Import - Home Page & History Only.
Review URL: http://codereview.chromium.org/159668 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/safari_importer.h')
-rw-r--r--chrome/browser/importer/safari_importer.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h
new file mode 100644
index 0000000..28b939f
--- /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_