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

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/sync/glue/session_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 if (tab_node.InitByIdLookup(tab_link->sync_id()) != 587 if (tab_node.InitByIdLookup(tab_link->sync_id()) !=
588 syncer::BaseNode::INIT_OK) { 588 syncer::BaseNode::INIT_OK) {
589 LOG(WARNING) << "Failed to load sync tab node for tab id " << tab_id 589 LOG(WARNING) << "Failed to load sync tab node for tab id " << tab_id
590 << " and url " << tab_link->url().spec(); 590 << " and url " << tab_link->url().spec();
591 return; 591 return;
592 } 592 }
593 sync_pb::SessionSpecifics session_specifics = 593 sync_pb::SessionSpecifics session_specifics =
594 tab_node.GetSessionSpecifics(); 594 tab_node.GetSessionSpecifics();
595 DCHECK(session_specifics.has_tab()); 595 DCHECK(session_specifics.has_tab());
596 sync_pb::SessionTab* tab = session_specifics.mutable_tab(); 596 sync_pb::SessionTab* tab = session_specifics.mutable_tab();
597 if (favicon.image_data->size() > 0) { 597 if (favicon.bitmap_data->size() > 0) {
598 DVLOG(1) << "Storing session favicon for " 598 DVLOG(1) << "Storing session favicon for "
599 << tab_link->url() << " with size " 599 << tab_link->url() << " with size "
600 << favicon.image_data->size() << " bytes."; 600 << favicon.bitmap_data->size() << " bytes.";
601 tab->set_favicon(favicon.image_data->front(), 601 tab->set_favicon(favicon.bitmap_data->front(),
602 favicon.image_data->size()); 602 favicon.bitmap_data->size());
603 tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON); 603 tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON);
604 tab->set_favicon_source(favicon.icon_url.spec()); 604 tab->set_favicon_source(favicon.icon_url.spec());
605 } else { 605 } else {
606 LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec(); 606 LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec();
607 } 607 }
608 tab_node.SetSessionSpecifics(session_specifics); 608 tab_node.SetSessionSpecifics(session_specifics);
609 } else { 609 } else {
610 // Else the favicon either isn't loaded yet or there is no favicon. We 610 // Else the favicon either isn't loaded yet or there is no favicon. We
611 // deliberately don't clear the tab_link's favicon_load_handle so we know 611 // deliberately don't clear the tab_link's favicon_load_handle so we know
612 // that we're still waiting for a favicon. ReceivedFavicons(..) below will 612 // that we're still waiting for a favicon. ReceivedFavicons(..) below will
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1590 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1591 // We only access the cryptographer while holding a transaction. 1591 // We only access the cryptographer while holding a transaction.
1592 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1592 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1593 const syncer::ModelTypeSet encrypted_types = 1593 const syncer::ModelTypeSet encrypted_types =
1594 syncer::GetEncryptedTypes(&trans); 1594 syncer::GetEncryptedTypes(&trans);
1595 return !encrypted_types.Has(SESSIONS) || 1595 return !encrypted_types.Has(SESSIONS) ||
1596 sync_service_->IsCryptographerReady(&trans); 1596 sync_service_->IsCryptographerReady(&trans);
1597 } 1597 }
1598 1598
1599 } // namespace browser_sync 1599 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698