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

Unified Diff: chrome/browser/history/android/favicon_sql_handler.cc

Issue 10815068: Changes favicon database to support storing bitmaps of different sizes for the same icon_url (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/android/favicon_sql_handler.cc
diff --git a/chrome/browser/history/android/favicon_sql_handler.cc b/chrome/browser/history/android/favicon_sql_handler.cc
index 0d68af5755ac273f9cfa17465cc586ebacc13aa4..e42068bb1c5ddc44494a6271ed8073812c33e72f 100644
--- a/chrome/browser/history/android/favicon_sql_handler.cc
+++ b/chrome/browser/history/android/favicon_sql_handler.cc
@@ -19,7 +19,7 @@ namespace {
const HistoryAndBookmarkRow::ColumnID kInterestingColumns[] = {
HistoryAndBookmarkRow::FAVICON};
-} // namespace
+} // namespace
FaviconSQLHandler::FaviconSQLHandler(ThumbnailDatabase* thumbnail_db)
: SQLHandler(kInterestingColumns, arraysize(kInterestingColumns)),
@@ -35,12 +35,16 @@ bool FaviconSQLHandler::Update(const HistoryAndBookmarkRow& row,
if (row.favicon_valid()) {
// If the image_data will be updated, it is not reasonable to find if the
// icon is already in database, just create a new favicon.
- favicon_id = thumbnail_db_->AddFavicon(GURL(), history::FAVICON);
- if (!favicon_id)
- return false;
+ // TODO(pkotwicz): Pass in real pixel size.
+ favicon_id = thumbnail_db_->AddFavicon(
+ GURL(),
+ history::FAVICON,
+ std::string("0 0"),
+ row.favicon(),
+ Time::Now(),
+ gfx::Size());
- scoped_refptr<base::RefCountedMemory> image_data = row.favicon();
- if (!thumbnail_db_->SetFavicon(favicon_id, image_data, Time::Now()))
+ if (!favicon_id)
return false;
}
@@ -110,13 +114,16 @@ bool FaviconSQLHandler::Insert(HistoryAndBookmarkRow* row) {
DCHECK(row->is_value_set_explicitly(HistoryAndBookmarkRow::URL));
// Is it a problem to give a empty URL?
- FaviconID id = thumbnail_db_->AddFavicon(GURL(), history::FAVICON);
+ // TODO(pkotwicz): Pass in real pixel size.
+ FaviconID id = thumbnail_db_->AddFavicon(
+ GURL(),
+ history::FAVICON,
+ std::string("0 0"),
+ row->favicon(),
+ Time::Now(),
+ gfx::Size());
if (!id)
return false;
-
- scoped_refptr<base::RefCountedMemory> image_data = row->favicon();
- if (!thumbnail_db_->SetFavicon(id, image_data, Time::Now()))
- return false;
return thumbnail_db_->AddIconMapping(row->url(), id);
}

Powered by Google App Engine
This is Rietveld 408576698