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

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

Issue 10844005: [Sync] Refactor GetEncryptedTypes usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + add dcheck 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
« no previous file with comments | « chrome/browser/sync/DEPS ('k') | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmark_change_processor.h" 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h"
6 6
7 #include <stack> 7 #include <stack>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } else if (!sync_node.GetEntry()->good()) { 226 } else if (!sync_node.GetEntry()->good()) {
227 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, 227 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
228 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed"); 228 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed");
229 LOG(ERROR) << "Bad entry."; 229 LOG(ERROR) << "Bad entry.";
230 } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) { 230 } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) {
231 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, 231 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
232 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true"); 232 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true");
233 LOG(ERROR) << "Deleted entry."; 233 LOG(ERROR) << "Deleted entry.";
234 } else { 234 } else {
235 syncer::Cryptographer* crypto = trans.GetCryptographer(); 235 syncer::Cryptographer* crypto = trans.GetCryptographer();
236 syncer::ModelTypeSet encrypted_types(crypto->GetEncryptedTypes()); 236 syncer::ModelTypeSet encrypted_types(trans.GetEncryptedTypes());
237 const sync_pb::EntitySpecifics& specifics = 237 const sync_pb::EntitySpecifics& specifics =
238 sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS); 238 sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS);
239 CHECK(specifics.has_encrypted()); 239 CHECK(specifics.has_encrypted());
240 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted()); 240 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted());
241 const bool agreement = encrypted_types.Has(syncer::BOOKMARKS); 241 const bool agreement = encrypted_types.Has(syncer::BOOKMARKS);
242 if (!agreement && !can_decrypt) { 242 if (!agreement && !can_decrypt) {
243 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, 243 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
244 "Could not InitByIdLookup on BookmarkNodeChanged, " 244 "Could not InitByIdLookup on BookmarkNodeChanged, "
245 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt" 245 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt"
246 " failed."); 246 " failed.");
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 const BookmarkNode* bookmark_node, 653 const BookmarkNode* bookmark_node,
654 BookmarkModel* model, 654 BookmarkModel* model,
655 syncer::WriteNode* sync_node) { 655 syncer::WriteNode* sync_node) {
656 std::vector<unsigned char> favicon_bytes; 656 std::vector<unsigned char> favicon_bytes;
657 EncodeFavicon(bookmark_node, model, &favicon_bytes); 657 EncodeFavicon(bookmark_node, model, &favicon_bytes);
658 if (!favicon_bytes.empty()) 658 if (!favicon_bytes.empty())
659 sync_node->SetFaviconBytes(favicon_bytes); 659 sync_node->SetFaviconBytes(favicon_bytes);
660 } 660 }
661 661
662 } // namespace browser_sync 662 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/DEPS ('k') | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698