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

Unified Diff: chrome/common/importer/safari_importer_utils.mm

Issue 18501013: Move most importer code to chrome/utility/importer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac4 Created 7 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/common/importer/safari_importer_utils.mm
diff --git a/chrome/common/importer/safari_importer_utils.mm b/chrome/common/importer/safari_importer_utils.mm
new file mode 100644
index 0000000000000000000000000000000000000000..1e7a7c817c5827ff2cb60dc69ec89af00c58fbba
--- /dev/null
+++ b/chrome/common/importer/safari_importer_utils.mm
@@ -0,0 +1,29 @@
+// Copyright 2013 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.
+
+#include "chrome/common/importer/safari_importer_utils.h"
+
+#include "base/logging.h"
+#include "base/file_util.h"
+#include "chrome/common/importer/importer_data_types.h"
+
+bool SafariImporterCanImport(const base::FilePath& library_dir,
gab 2013/07/08 15:18:08 I would also prefer if this was done in a separate
scottmg 2013/07/09 16:20:49 hrm, ok. moved back into safari_importer.
gab 2013/07/09 20:48:31 err, my bad, I meant as a precursor CL rather than
+ uint16* services_supported) {
+ DCHECK(services_supported);
+ *services_supported = importer::NONE;
+
+ // Import features are toggled by the following:
+ // bookmarks import: existence of ~/Library/Safari/Bookmarks.plist file.
+ // history import: existence of ~/Library/Safari/History.plist file.
+ base::FilePath safari_dir = library_dir.Append("Safari");
+ base::FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist");
+ base::FilePath history_path = safari_dir.Append("History.plist");
+
+ if (file_util::PathExists(bookmarks_path))
+ *services_supported |= importer::FAVORITES;
+ if (file_util::PathExists(history_path))
+ *services_supported |= importer::HISTORY;
+
+ return *services_supported != importer::NONE;
+}

Powered by Google App Engine
This is Rietveld 408576698