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 "chrome/browser/history/android/android_provider_backend.h" | 5 #include "chrome/browser/history/android/android_provider_backend.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "chrome/browser/bookmarks/bookmark_service.h" | 8 #include "chrome/browser/bookmarks/bookmark_service.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/browser/history/android/android_time.h" | 10 #include "chrome/browser/history/android/android_time.h" |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 new_row.set_visit_count(statement->statement()->ColumnInt(2)); | 893 new_row.set_visit_count(statement->statement()->ColumnInt(2)); |
894 new_row.set_title(statement->statement()->ColumnString16(3)); | 894 new_row.set_title(statement->statement()->ColumnString16(3)); |
895 | 895 |
896 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); | 896 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); |
897 scoped_ptr<FaviconChangeDetails> favicon_details(new FaviconChangeDetails); | 897 scoped_ptr<FaviconChangeDetails> favicon_details(new FaviconChangeDetails); |
898 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails); | 898 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails); |
899 URLRow old_url_row; | 899 URLRow old_url_row; |
900 if (!history_db_->GetURLRow(ids[0].url_id, &old_url_row)) | 900 if (!history_db_->GetURLRow(ids[0].url_id, &old_url_row)) |
901 return false; | 901 return false; |
902 deleted_details->rows.push_back(old_url_row); | 902 deleted_details->rows.push_back(old_url_row); |
| 903 deleted_details->urls.insert(old_url_row.url()); |
903 | 904 |
904 FaviconID favicon_id = statement->statement()->ColumnInt64(4); | 905 FaviconID favicon_id = statement->statement()->ColumnInt64(4); |
905 if (favicon_id) { | 906 if (favicon_id) { |
906 std::vector<unsigned char> favicon; | 907 std::vector<unsigned char> favicon; |
907 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) | 908 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) |
908 return false; | 909 return false; |
909 if (!favicon.empty()) | 910 if (!favicon.empty()) |
910 new_row.set_favicon(favicon); | 911 new_row.set_favicon(favicon); |
911 favicon_details->urls.insert(old_url_row.url()); | 912 favicon_details->urls.insert(old_url_row.url()); |
912 favicon_details->urls.insert(row.url()); | 913 favicon_details->urls.insert(row.url()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 bool AndroidProviderBackend::DeleteHistoryInternal( | 1019 bool AndroidProviderBackend::DeleteHistoryInternal( |
1019 const TableIDRows& urls, | 1020 const TableIDRows& urls, |
1020 HistoryNotifications* notifications) { | 1021 HistoryNotifications* notifications) { |
1021 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); | 1022 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); |
1022 scoped_ptr<FaviconChangeDetails> favicon(new FaviconChangeDetails); | 1023 scoped_ptr<FaviconChangeDetails> favicon(new FaviconChangeDetails); |
1023 for (TableIDRows::const_iterator i = urls.begin(); i != urls.end(); ++i) { | 1024 for (TableIDRows::const_iterator i = urls.begin(); i != urls.end(); ++i) { |
1024 URLRow url_row; | 1025 URLRow url_row; |
1025 if (!history_db_->GetURLRow(i->url_id, &url_row)) | 1026 if (!history_db_->GetURLRow(i->url_id, &url_row)) |
1026 return false; | 1027 return false; |
1027 deleted_details->rows.push_back(url_row); | 1028 deleted_details->rows.push_back(url_row); |
| 1029 deleted_details->urls.insert(url_row.url()); |
1028 if (thumbnail_db_->GetIconMappingsForPageURL(url_row.url(), NULL)) | 1030 if (thumbnail_db_->GetIconMappingsForPageURL(url_row.url(), NULL)) |
1029 favicon->urls.insert(url_row.url()); | 1031 favicon->urls.insert(url_row.url()); |
1030 } | 1032 } |
1031 | 1033 |
1032 for (std::vector<SQLHandler*>::iterator i = | 1034 for (std::vector<SQLHandler*>::iterator i = |
1033 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { | 1035 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { |
1034 if (!(*i)->Delete(urls)) | 1036 if (!(*i)->Delete(urls)) |
1035 return false; | 1037 return false; |
1036 } | 1038 } |
1037 | 1039 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 return false; | 1099 return false; |
1098 | 1100 |
1099 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1101 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
1100 values.template_url_id(), values.search_term())) | 1102 values.template_url_id(), values.search_term())) |
1101 return false; | 1103 return false; |
1102 } | 1104 } |
1103 return true; | 1105 return true; |
1104 } | 1106 } |
1105 | 1107 |
1106 } // namespace history | 1108 } // namespace history |
OLD | NEW |