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

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl.cc

Issue 10832286: sync: Introduce control data types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 "sync/internal_api/sync_encryption_handler_impl.h" 5 #include "sync/internal_api/sync_encryption_handler_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // the lookup of the root node will fail and we will skip encryption for that 395 // the lookup of the root node will fail and we will skip encryption for that
396 // type. 396 // type.
397 void SyncEncryptionHandlerImpl::ReEncryptEverything( 397 void SyncEncryptionHandlerImpl::ReEncryptEverything(
398 WriteTransaction* trans) { 398 WriteTransaction* trans) {
399 Cryptographer* cryptographer = trans->GetCryptographer(); 399 Cryptographer* cryptographer = trans->GetCryptographer();
400 if (!cryptographer->is_ready()) 400 if (!cryptographer->is_ready())
401 return; 401 return;
402 ModelTypeSet encrypted_types = GetEncryptedTypes(); 402 ModelTypeSet encrypted_types = GetEncryptedTypes();
403 for (ModelTypeSet::Iterator iter = encrypted_types.First(); 403 for (ModelTypeSet::Iterator iter = encrypted_types.First();
404 iter.Good(); iter.Inc()) { 404 iter.Good(); iter.Inc()) {
405 if (iter.Get() == PASSWORDS || iter.Get() == NIGORI) 405 if (iter.Get() == PASSWORDS || IsControlType(iter.Get()))
406 continue; // These types handle encryption differently. 406 continue; // These types handle encryption differently.
407 407
408 ReadNode type_root(trans); 408 ReadNode type_root(trans);
409 std::string tag = ModelTypeToRootTag(iter.Get()); 409 std::string tag = ModelTypeToRootTag(iter.Get());
410 if (type_root.InitByTagLookup(tag) != BaseNode::INIT_OK) 410 if (type_root.InitByTagLookup(tag) != BaseNode::INIT_OK)
411 continue; // Don't try to reencrypt if the type's data is unavailable. 411 continue; // Don't try to reencrypt if the type's data is unavailable.
412 412
413 // Iterate through all children of this datatype. 413 // Iterate through all children of this datatype.
414 std::queue<int64> to_visit; 414 std::queue<int64> to_visit;
415 int64 child_id = type_root.GetFirstChildId(); 415 int64 child_id = type_root.GetFirstChildId();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 ModelTypeSet encrypted_types) { 669 ModelTypeSet encrypted_types) {
670 if (!encrypted_types_.HasAll(encrypted_types)) { 670 if (!encrypted_types_.HasAll(encrypted_types)) {
671 encrypted_types_ = encrypted_types; 671 encrypted_types_ = encrypted_types;
672 FOR_EACH_OBSERVER( 672 FOR_EACH_OBSERVER(
673 Observer, observers_, 673 Observer, observers_,
674 OnEncryptedTypesChanged(encrypted_types_, encrypt_everything_)); 674 OnEncryptedTypesChanged(encrypted_types_, encrypt_everything_));
675 } 675 }
676 } 676 }
677 677
678 } // namespace browser_sync 678 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698