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()); | |
904 | 903 |
905 FaviconID favicon_id = statement->statement()->ColumnInt64(4); | 904 FaviconID favicon_id = statement->statement()->ColumnInt64(4); |
906 if (favicon_id) { | 905 if (favicon_id) { |
907 std::vector<unsigned char> favicon; | 906 std::vector<unsigned char> favicon; |
908 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) | 907 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) |
909 return false; | 908 return false; |
910 if (!favicon.empty()) | 909 if (!favicon.empty()) |
911 new_row.set_favicon(favicon); | 910 new_row.set_favicon(favicon); |
912 favicon_details->urls.insert(old_url_row.url()); | 911 favicon_details->urls.insert(old_url_row.url()); |
913 favicon_details->urls.insert(row.url()); | 912 favicon_details->urls.insert(row.url()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 bool AndroidProviderBackend::DeleteHistoryInternal( | 1018 bool AndroidProviderBackend::DeleteHistoryInternal( |
1020 const TableIDRows& urls, | 1019 const TableIDRows& urls, |
1021 HistoryNotifications* notifications) { | 1020 HistoryNotifications* notifications) { |
1022 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); | 1021 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); |
1023 scoped_ptr<FaviconChangeDetails> favicon(new FaviconChangeDetails); | 1022 scoped_ptr<FaviconChangeDetails> favicon(new FaviconChangeDetails); |
1024 for (TableIDRows::const_iterator i = urls.begin(); i != urls.end(); ++i) { | 1023 for (TableIDRows::const_iterator i = urls.begin(); i != urls.end(); ++i) { |
1025 URLRow url_row; | 1024 URLRow url_row; |
1026 if (!history_db_->GetURLRow(i->url_id, &url_row)) | 1025 if (!history_db_->GetURLRow(i->url_id, &url_row)) |
1027 return false; | 1026 return false; |
1028 deleted_details->rows.push_back(url_row); | 1027 deleted_details->rows.push_back(url_row); |
1029 deleted_details->urls.insert(url_row.url()); | |
1030 if (thumbnail_db_->GetIconMappingsForPageURL(url_row.url(), NULL)) | 1028 if (thumbnail_db_->GetIconMappingsForPageURL(url_row.url(), NULL)) |
1031 favicon->urls.insert(url_row.url()); | 1029 favicon->urls.insert(url_row.url()); |
1032 } | 1030 } |
1033 | 1031 |
1034 for (std::vector<SQLHandler*>::iterator i = | 1032 for (std::vector<SQLHandler*>::iterator i = |
1035 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { | 1033 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { |
1036 if (!(*i)->Delete(urls)) | 1034 if (!(*i)->Delete(urls)) |
1037 return false; | 1035 return false; |
1038 } | 1036 } |
1039 | 1037 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 return false; | 1097 return false; |
1100 | 1098 |
1101 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1099 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
1102 values.template_url_id(), values.search_term())) | 1100 values.template_url_id(), values.search_term())) |
1103 return false; | 1101 return false; |
1104 } | 1102 } |
1105 return true; | 1103 return true; |
1106 } | 1104 } |
1107 | 1105 |
1108 } // namespace history | 1106 } // namespace history |
OLD | NEW |