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

Unified Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for 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/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 9c690d30976ab340f50b778f8235a4ece4e1cda5..58dc3a6d7004965a86d5c668458f91bc75a41df8 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -42,6 +42,7 @@
#include "sync/syncable/write_transaction.h"
#include "sync/util/get_session_name.h"
#include "sync/util/time.h"
+#include "ui/gfx/favicon_size.h"
#if defined(OS_LINUX)
#include "base/linux_util.h"
#elif defined(OS_WIN)
@@ -551,8 +552,9 @@ void SessionModelAssociator::LoadFaviconForTab(TabLink* tab_link) {
load_consumer_.CancelAllRequestsForClientData(tab_id);
}
DVLOG(1) << "Triggering favicon load for url " << tab_link->url().spec();
- FaviconService::Handle handle = favicon_service->GetFaviconForURL(
- profile_, tab_link->url(), history::FAVICON, &load_consumer_,
+ FaviconService::Handle handle = favicon_service->GetRawFaviconForURL(
+ profile_, tab_link->url(), history::FAVICON, gfx::kFaviconSize,
+ ui::SCALE_FACTOR_100P, &load_consumer_,
base::Bind(&SessionModelAssociator::OnFaviconDataAvailable,
AsWeakPtr()));
load_consumer_.SetClientData(favicon_service, handle, tab_id);
@@ -561,7 +563,7 @@ void SessionModelAssociator::LoadFaviconForTab(TabLink* tab_link) {
void SessionModelAssociator::OnFaviconDataAvailable(
FaviconService::Handle handle,
- history::FaviconData favicon) {
+ const history::FaviconBitmapResult& bitmap_result) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kSyncTabFavicons))
return;
@@ -581,10 +583,10 @@ void SessionModelAssociator::OnFaviconDataAvailable(
// been canceled if the url had changed, we know the url must still be
// up to date.
- if (favicon.is_valid()) {
+ if (bitmap_result.is_valid()) {
DCHECK_EQ(handle, tab_link->favicon_load_handle());
tab_link->set_favicon_load_handle(0);
- DCHECK_EQ(favicon.icon_type, history::FAVICON);
+ DCHECK_EQ(bitmap_result.icon_type, history::FAVICON);
DCHECK_NE(tab_link->sync_id(), syncer::kInvalidId);
// Load the sync tab node and update the favicon data.
syncer::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare());
@@ -599,14 +601,14 @@ void SessionModelAssociator::OnFaviconDataAvailable(
tab_node.GetSessionSpecifics();
DCHECK(session_specifics.has_tab());
sync_pb::SessionTab* tab = session_specifics.mutable_tab();
- if (favicon.image_data->size() > 0) {
+ if (bitmap_result.bitmap_data->size() > 0) {
DVLOG(1) << "Storing session favicon for "
<< tab_link->url() << " with size "
- << favicon.image_data->size() << " bytes.";
- tab->set_favicon(favicon.image_data->front(),
- favicon.image_data->size());
+ << bitmap_result.bitmap_data->size() << " bytes.";
+ tab->set_favicon(bitmap_result.bitmap_data->front(),
+ bitmap_result.bitmap_data->size());
tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON);
- tab->set_favicon_source(favicon.icon_url.spec());
+ tab->set_favicon_source(bitmap_result.icon_url.spec());
} else {
LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec();
}

Powered by Google App Engine
This is Rietveld 408576698