| 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/utility/importer/safari_importer.h" | 7 #include "chrome/utility/importer/safari_importer.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 SafariImporter::SafariImporter(const base::FilePath& library_dir) | 44 SafariImporter::SafariImporter(const base::FilePath& library_dir) |
| 45 : library_dir_(library_dir) { | 45 : library_dir_(library_dir) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 SafariImporter::~SafariImporter() { | 48 SafariImporter::~SafariImporter() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SafariImporter::StartImport(const importer::SourceProfile& source_profile, | 51 void SafariImporter::StartImport(const importer::SourceProfile& source_profile, |
| 52 uint16 items, | 52 uint16_t items, |
| 53 ImporterBridge* bridge) { | 53 ImporterBridge* bridge) { |
| 54 bridge_ = bridge; | 54 bridge_ = bridge; |
| 55 // The order here is important! | 55 // The order here is important! |
| 56 bridge_->NotifyStarted(); | 56 bridge_->NotifyStarted(); |
| 57 | 57 |
| 58 // In keeping with import on other platforms (and for other browsers), we | 58 // In keeping with import on other platforms (and for other browsers), we |
| 59 // don't import the home page (since it may lead to a useless homepage); see | 59 // don't import the home page (since it may lead to a useless homepage); see |
| 60 // crbug.com/25603. | 60 // crbug.com/25603. |
| 61 if ((items & importer::HISTORY) && !cancelled()) { | 61 if ((items & importer::HISTORY) && !cancelled()) { |
| 62 bridge_->NotifyItemStarted(importer::HISTORY); | 62 bridge_->NotifyItemStarted(importer::HISTORY); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const char* db_path = [favicons_db_path fileSystemRepresentation]; | 116 const char* db_path = [favicons_db_path fileSystemRepresentation]; |
| 117 return db->Open(base::FilePath(db_path)); | 117 return db->Open(base::FilePath(db_path)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SafariImporter::ImportFaviconURLs(sql::Connection* db, | 120 void SafariImporter::ImportFaviconURLs(sql::Connection* db, |
| 121 FaviconMap* favicon_map) { | 121 FaviconMap* favicon_map) { |
| 122 const char query[] = "SELECT iconID, url FROM PageURL;"; | 122 const char query[] = "SELECT iconID, url FROM PageURL;"; |
| 123 sql::Statement s(db->GetUniqueStatement(query)); | 123 sql::Statement s(db->GetUniqueStatement(query)); |
| 124 | 124 |
| 125 while (s.Step() && !cancelled()) { | 125 while (s.Step() && !cancelled()) { |
| 126 int64 icon_id = s.ColumnInt64(0); | 126 int64_t icon_id = s.ColumnInt64(0); |
| 127 GURL url = GURL(s.ColumnString(1)); | 127 GURL url = GURL(s.ColumnString(1)); |
| 128 (*favicon_map)[icon_id].insert(url); | 128 (*favicon_map)[icon_id].insert(url); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void SafariImporter::LoadFaviconData( | 132 void SafariImporter::LoadFaviconData( |
| 133 sql::Connection* db, | 133 sql::Connection* db, |
| 134 const FaviconMap& favicon_map, | 134 const FaviconMap& favicon_map, |
| 135 favicon_base::FaviconUsageDataList* favicons) { | 135 favicon_base::FaviconUsageDataList* favicons) { |
| 136 const char query[] = "SELECT i.url, d.data " | 136 const char query[] = "SELECT i.url, d.data " |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (!last_visit_str) | 372 if (!last_visit_str) |
| 373 continue; | 373 continue; |
| 374 | 374 |
| 375 // Convert Safari's last visit time to Unix Epoch time. | 375 // Convert Safari's last visit time to Unix Epoch time. |
| 376 double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); | 376 double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); |
| 377 row.last_visit = base::Time::FromDoubleT(seconds_since_unix_epoch); | 377 row.last_visit = base::Time::FromDoubleT(seconds_since_unix_epoch); |
| 378 | 378 |
| 379 history_items->push_back(row); | 379 history_items->push_back(row); |
| 380 } | 380 } |
| 381 } | 381 } |
| OLD | NEW |