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

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 7551024: [Sync] Fix encryption/passphrase handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix allstatus Created 9 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/profile_sync_service.cc ('k') | chrome/browser/sync/sync_setup_flow.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <iterator> 9 #include <iterator>
10 #include <ostream> 10 #include <ostream>
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 return os.str(); 789 return os.str();
790 } 790 }
791 791
792 bool ProfileSyncServiceHarness::EnableEncryptionForType( 792 bool ProfileSyncServiceHarness::EnableEncryptionForType(
793 syncable::ModelType type) { 793 syncable::ModelType type) {
794 syncable::ModelTypeSet encrypted_types; 794 syncable::ModelTypeSet encrypted_types;
795 service_->GetEncryptedDataTypes(&encrypted_types); 795 service_->GetEncryptedDataTypes(&encrypted_types);
796 if (encrypted_types.count(type) > 0) 796 if (encrypted_types.count(type) > 0)
797 return true; 797 return true;
798 encrypted_types.insert(type); 798 encrypted_types.insert(type);
799 service_->EncryptDataTypes(encrypted_types); 799 service_->set_pending_types_for_encryption(encrypted_types);
800
801 // In order to kick off the encryption we have to reconfigure. Just grab the
802 // currently synced types and use them.
803 syncable::ModelTypeSet synced_datatypes;
804 service_->GetPreferredDataTypes(&synced_datatypes);
805 bool sync_everything = (synced_datatypes.size() ==
806 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE));
807 service_->OnUserChoseDatatypes(sync_everything,
808 synced_datatypes);
800 809
801 // Wait some time to let the enryption finish. 810 // Wait some time to let the enryption finish.
802 return WaitForTypeEncryption(type); 811 return WaitForTypeEncryption(type);
803 } 812 }
804 813
805 bool ProfileSyncServiceHarness::WaitForTypeEncryption( 814 bool ProfileSyncServiceHarness::WaitForTypeEncryption(
806 syncable::ModelType type) { 815 syncable::ModelType type) {
807 if (IsSynced() && 816 if (IsSynced() &&
808 IsTypeEncrypted(type) && 817 IsTypeEncrypted(type) &&
809 GetLastSessionSnapshot()->num_conflicting_updates == 0) { 818 GetLastSessionSnapshot()->num_conflicting_updates == 0) {
(...skipping 22 matching lines...) Expand all
832 return true; 841 return true;
833 } 842 }
834 843
835 std::string ProfileSyncServiceHarness::GetServiceStatus() { 844 std::string ProfileSyncServiceHarness::GetServiceStatus() {
836 DictionaryValue value; 845 DictionaryValue value;
837 sync_ui_util::ConstructAboutInformation(service_, &value); 846 sync_ui_util::ConstructAboutInformation(service_, &value);
838 std::string service_status; 847 std::string service_status;
839 base::JSONWriter::Write(&value, true, &service_status); 848 base::JSONWriter::Write(&value, true, &service_status);
840 return service_status; 849 return service_status;
841 } 850 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/sync_setup_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698