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

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

Issue 10821035: wip 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/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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 if (tab_node.InitByIdLookup(tab_link->sync_id()) != 593 if (tab_node.InitByIdLookup(tab_link->sync_id()) !=
594 syncer::BaseNode::INIT_OK) { 594 syncer::BaseNode::INIT_OK) {
595 LOG(WARNING) << "Failed to load sync tab node for tab id " << tab_id 595 LOG(WARNING) << "Failed to load sync tab node for tab id " << tab_id
596 << " and url " << tab_link->url().spec(); 596 << " and url " << tab_link->url().spec();
597 return; 597 return;
598 } 598 }
599 sync_pb::SessionSpecifics session_specifics = 599 sync_pb::SessionSpecifics session_specifics =
600 tab_node.GetSessionSpecifics(); 600 tab_node.GetSessionSpecifics();
601 DCHECK(session_specifics.has_tab()); 601 DCHECK(session_specifics.has_tab());
602 sync_pb::SessionTab* tab = session_specifics.mutable_tab(); 602 sync_pb::SessionTab* tab = session_specifics.mutable_tab();
603 if (favicon.bitmap_data->size() > 0) { 603 if (favicon.variants.size() > 0 &&
604 favicon.variants[0].bitmap_data->size() > 0) {
604 DVLOG(1) << "Storing session favicon for " 605 DVLOG(1) << "Storing session favicon for "
605 << tab_link->url() << " with size " 606 << tab_link->url() << " with size "
606 << favicon.bitmap_data->size() << " bytes."; 607 << favicon.variants[0].bitmap_data->size() << " bytes.";
607 tab->set_favicon(favicon.bitmap_data->front(), 608 tab->set_favicon(favicon.variants[0].bitmap_data->front(),
608 favicon.bitmap_data->size()); 609 favicon.variants[0].bitmap_data->size());
609 tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON); 610 tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON);
610 tab->set_favicon_source(favicon.icon_url.spec()); 611 tab->set_favicon_source(favicon.icon_url.spec());
611 } else { 612 } else {
612 LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec(); 613 LOG(WARNING) << "Null favicon stored for url " << tab_link->url().spec();
613 } 614 }
614 tab_node.SetSessionSpecifics(session_specifics); 615 tab_node.SetSessionSpecifics(session_specifics);
615 } else { 616 } else {
616 // Else the favicon either isn't loaded yet or there is no favicon. We 617 // Else the favicon either isn't loaded yet or there is no favicon. We
617 // deliberately don't clear the tab_link's favicon_load_handle so we know 618 // deliberately don't clear the tab_link's favicon_load_handle so we know
618 // that we're still waiting for a favicon. ReceivedFavicons(..) below will 619 // that we're still waiting for a favicon. ReceivedFavicons(..) below will
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1597 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1597 // We only access the cryptographer while holding a transaction. 1598 // We only access the cryptographer while holding a transaction.
1598 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1599 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1599 const syncer::ModelTypeSet encrypted_types = 1600 const syncer::ModelTypeSet encrypted_types =
1600 syncer::GetEncryptedTypes(&trans); 1601 syncer::GetEncryptedTypes(&trans);
1601 return !encrypted_types.Has(SESSIONS) || 1602 return !encrypted_types.Has(SESSIONS) ||
1602 sync_service_->IsCryptographerReady(&trans); 1603 sync_service_->IsCryptographerReady(&trans);
1603 } 1604 }
1604 1605
1605 } // namespace browser_sync 1606 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/history/thumbnail_database_unittest.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698