| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> | 
| 6 | 6 | 
| 7 #include "chrome/browser/importer/safari_importer.h" | 7 #include "chrome/browser/importer/safari_importer.h" | 
| 8 | 8 | 
| 9 #include <map> | 9 #include <map> | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 54   DCHECK(services_supported); | 54   DCHECK(services_supported); | 
| 55   *services_supported = importer::NONE; | 55   *services_supported = importer::NONE; | 
| 56 | 56 | 
| 57   // Import features are toggled by the following: | 57   // Import features are toggled by the following: | 
| 58   // bookmarks import: existence of ~/Library/Safari/Bookmarks.plist file. | 58   // bookmarks import: existence of ~/Library/Safari/Bookmarks.plist file. | 
| 59   // history import: existence of ~/Library/Safari/History.plist file. | 59   // history import: existence of ~/Library/Safari/History.plist file. | 
| 60   base::FilePath safari_dir = library_dir.Append("Safari"); | 60   base::FilePath safari_dir = library_dir.Append("Safari"); | 
| 61   base::FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); | 61   base::FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); | 
| 62   base::FilePath history_path = safari_dir.Append("History.plist"); | 62   base::FilePath history_path = safari_dir.Append("History.plist"); | 
| 63 | 63 | 
| 64   if (file_util::PathExists(bookmarks_path)) | 64   if (base::PathExists(bookmarks_path)) | 
| 65     *services_supported |= importer::FAVORITES; | 65     *services_supported |= importer::FAVORITES; | 
| 66   if (file_util::PathExists(history_path)) | 66   if (base::PathExists(history_path)) | 
| 67     *services_supported |= importer::HISTORY; | 67     *services_supported |= importer::HISTORY; | 
| 68 | 68 | 
| 69   return *services_supported != importer::NONE; | 69   return *services_supported != importer::NONE; | 
| 70 } | 70 } | 
| 71 | 71 | 
| 72 void SafariImporter::StartImport(const importer::SourceProfile& source_profile, | 72 void SafariImporter::StartImport(const importer::SourceProfile& source_profile, | 
| 73                                  uint16 items, | 73                                  uint16 items, | 
| 74                                  ImporterBridge* bridge) { | 74                                  ImporterBridge* bridge) { | 
| 75   bridge_ = bridge; | 75   bridge_ = bridge; | 
| 76   // The order here is important! | 76   // The order here is important! | 
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390     if (!last_visit_str) | 390     if (!last_visit_str) | 
| 391       continue; | 391       continue; | 
| 392 | 392 | 
| 393     // Convert Safari's last visit time to Unix Epoch time. | 393     // Convert Safari's last visit time to Unix Epoch time. | 
| 394     double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); | 394     double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); | 
| 395     row.last_visit = base::Time::FromDoubleT(seconds_since_unix_epoch); | 395     row.last_visit = base::Time::FromDoubleT(seconds_since_unix_epoch); | 
| 396 | 396 | 
| 397     history_items->push_back(row); | 397     history_items->push_back(row); | 
| 398   } | 398   } | 
| 399 } | 399 } | 
| OLD | NEW | 
|---|