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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); | 959 scoped_ptr<URLsDeletedDetails> deleted_details(new URLsDeletedDetails); |
960 scoped_ptr<FaviconChangeDetails> favicon_details(new FaviconChangeDetails); | 960 scoped_ptr<FaviconChangeDetails> favicon_details(new FaviconChangeDetails); |
961 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails); | 961 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails); |
962 URLRow old_url_row; | 962 URLRow old_url_row; |
963 if (!history_db_->GetURLRow(ids[0].url_id, &old_url_row)) | 963 if (!history_db_->GetURLRow(ids[0].url_id, &old_url_row)) |
964 return false; | 964 return false; |
965 deleted_details->rows.push_back(old_url_row); | 965 deleted_details->rows.push_back(old_url_row); |
966 | 966 |
967 FaviconID favicon_id = statement->statement()->ColumnInt64(4); | 967 FaviconID favicon_id = statement->statement()->ColumnInt64(4); |
968 if (favicon_id) { | 968 if (favicon_id) { |
969 scoped_refptr<base::RefCountedMemory> favicon; | 969 std::vector<FaviconBitmap> favicon_bitmaps; |
970 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) | 970 if (!thumbnail_db_->GetFaviconBitmaps(favicon_id, &favicon_bitmaps)) |
971 return false; | 971 return false; |
972 if (favicon.get() && favicon->size()) | 972 scoped_refptr<base::RefCountedMemory> bitmap_data = |
973 new_row.set_favicon(favicon); | 973 favicon_bitmaps[0].bitmap_data; |
| 974 if (bitmap_data.get() && bitmap_data->size()) |
| 975 new_row.set_favicon(bitmap_data); |
974 favicon_details->urls.insert(old_url_row.url()); | 976 favicon_details->urls.insert(old_url_row.url()); |
975 favicon_details->urls.insert(row.url()); | 977 favicon_details->urls.insert(row.url()); |
976 } | 978 } |
977 new_row.set_is_bookmark(statement->statement()->ColumnBool(5)); | 979 new_row.set_is_bookmark(statement->statement()->ColumnBool(5)); |
978 | 980 |
979 // The SQLHandler vector is not used here because the row in android_url | 981 // The SQLHandler vector is not used here because the row in android_url |
980 // shouldn't be deleted, we need keep the AndroidUIID unchanged, so it | 982 // shouldn't be deleted, we need keep the AndroidUIID unchanged, so it |
981 // appears update to the client. | 983 // appears update to the client. |
982 if (!urls_handler_->Delete(ids)) | 984 if (!urls_handler_->Delete(ids)) |
983 return false; | 985 return false; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 return false; | 1166 return false; |
1165 | 1167 |
1166 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1168 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
1167 values.template_url_id(), values.search_term())) | 1169 values.template_url_id(), values.search_term())) |
1168 return false; | 1170 return false; |
1169 } | 1171 } |
1170 return true; | 1172 return true; |
1171 } | 1173 } |
1172 | 1174 |
1173 } // namespace history | 1175 } // namespace history |
OLD | NEW |