Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: chrome/browser/history/android/android_provider_backend.cc

Issue 10831341: Change HistoryAndBookmarkRow favicon_ field to be scoped_refptr<base::RefCountedMemory> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (!history_db_->GetURLRow(row.url_id(), &url_row)) 378 if (!history_db_->GetURLRow(row.url_id(), &url_row))
379 return false; 379 return false;
380 380
381 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails); 381 scoped_ptr<URLsModifiedDetails> modified(new URLsModifiedDetails);
382 if (!modified.get()) 382 if (!modified.get())
383 return false; 383 return false;
384 modified->changed_urls.push_back(url_row); 384 modified->changed_urls.push_back(url_row);
385 385
386 scoped_ptr<FaviconChangeDetails> favicon; 386 scoped_ptr<FaviconChangeDetails> favicon;
387 if (row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON) && 387 if (row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON) &&
388 !row.favicon().empty()) { 388 row.favicon_valid()) {
389 favicon.reset(new FaviconChangeDetails); 389 favicon.reset(new FaviconChangeDetails);
390 if (!favicon.get()) 390 if (!favicon.get())
391 return false; 391 return false;
392 favicon->urls.insert(url_row.url()); 392 favicon->urls.insert(url_row.url());
393 } 393 }
394 394
395 notifications->push_back(HistoryNotification( 395 notifications->push_back(HistoryNotification(
396 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, modified.release())); 396 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, modified.release()));
397 if (favicon.get()) 397 if (favicon.get())
398 notifications->push_back(HistoryNotification( 398 notifications->push_back(HistoryNotification(
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::vector<unsigned char> favicon; 969 scoped_refptr<base::RefCountedBytes> favicon = new base::RefCountedBytes();
970 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon, NULL, NULL)) 970 if (!thumbnail_db_->GetFavicon(favicon_id, NULL, &favicon->data(), NULL,
971 NULL))
971 return false; 972 return false;
972 if (!favicon.empty()) 973 if (favicon->size())
973 new_row.set_favicon(favicon); 974 new_row.set_favicon(favicon);
974 favicon_details->urls.insert(old_url_row.url()); 975 favicon_details->urls.insert(old_url_row.url());
975 favicon_details->urls.insert(row.url()); 976 favicon_details->urls.insert(row.url());
976 } 977 }
977 new_row.set_is_bookmark(statement->statement()->ColumnBool(5)); 978 new_row.set_is_bookmark(statement->statement()->ColumnBool(5));
978 979
979 // The SQLHandler vector is not used here because the row in android_url 980 // 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 981 // shouldn't be deleted, we need keep the AndroidUIID unchanged, so it
981 // appears update to the client. 982 // appears update to the client.
982 if (!urls_handler_->Delete(ids)) 983 if (!urls_handler_->Delete(ids))
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 return false; 1165 return false;
1165 1166
1166 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), 1167 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(),
1167 values.template_url_id(), values.search_term())) 1168 values.template_url_id(), values.search_term()))
1168 return false; 1169 return false;
1169 } 1170 }
1170 return true; 1171 return true;
1171 } 1172 }
1172 1173
1173 } // namespace history 1174 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698