| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const FaviconMap& favicon_map, | 155 const FaviconMap& favicon_map, |
| 156 std::vector<history::ImportedFaviconUsage>* favicons) { | 156 std::vector<history::ImportedFaviconUsage>* favicons) { |
| 157 const char* query = "SELECT i.url, d.data " | 157 const char* query = "SELECT i.url, d.data " |
| 158 "FROM IconInfo i JOIN IconData d " | 158 "FROM IconInfo i JOIN IconData d " |
| 159 "ON i.iconID = d.iconID " | 159 "ON i.iconID = d.iconID " |
| 160 "WHERE i.iconID = ?;"; | 160 "WHERE i.iconID = ?;"; |
| 161 sql::Statement s(db->GetUniqueStatement(query)); | 161 sql::Statement s(db->GetUniqueStatement(query)); |
| 162 | 162 |
| 163 for (FaviconMap::const_iterator i = favicon_map.begin(); | 163 for (FaviconMap::const_iterator i = favicon_map.begin(); |
| 164 i != favicon_map.end(); ++i) { | 164 i != favicon_map.end(); ++i) { |
| 165 s.Reset(); | 165 s.Reset(true); |
| 166 s.BindInt64(0, i->first); | 166 s.BindInt64(0, i->first); |
| 167 if (s.Step()) { | 167 if (s.Step()) { |
| 168 history::ImportedFaviconUsage usage; | 168 history::ImportedFaviconUsage usage; |
| 169 | 169 |
| 170 usage.favicon_url = GURL(s.ColumnString(0)); | 170 usage.favicon_url = GURL(s.ColumnString(0)); |
| 171 if (!usage.favicon_url.is_valid()) | 171 if (!usage.favicon_url.is_valid()) |
| 172 continue; // Don't bother importing favicons with invalid URLs. | 172 continue; // Don't bother importing favicons with invalid URLs. |
| 173 | 173 |
| 174 std::vector<unsigned char> data; | 174 std::vector<unsigned char> data; |
| 175 s.ColumnBlobAsVector(1, &data); | 175 s.ColumnBlobAsVector(1, &data); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (!last_visit_str) | 389 if (!last_visit_str) |
| 390 continue; | 390 continue; |
| 391 | 391 |
| 392 // Convert Safari's last visit time to Unix Epoch time. | 392 // Convert Safari's last visit time to Unix Epoch time. |
| 393 double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); | 393 double seconds_since_unix_epoch = HistoryTimeToEpochTime(last_visit_str); |
| 394 row.set_last_visit(base::Time::FromDoubleT(seconds_since_unix_epoch)); | 394 row.set_last_visit(base::Time::FromDoubleT(seconds_since_unix_epoch)); |
| 395 | 395 |
| 396 history_items->push_back(row); | 396 history_items->push_back(row); |
| 397 } | 397 } |
| 398 } | 398 } |
| OLD | NEW |