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

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

Issue 7583032: Merge 95693 - [Sync] Fix encryption/passphrase handling. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 return os.str(); 766 return os.str();
767 } 767 }
768 768
769 bool ProfileSyncServiceHarness::EnableEncryptionForType( 769 bool ProfileSyncServiceHarness::EnableEncryptionForType(
770 syncable::ModelType type) { 770 syncable::ModelType type) {
771 syncable::ModelTypeSet encrypted_types; 771 syncable::ModelTypeSet encrypted_types;
772 service_->GetEncryptedDataTypes(&encrypted_types); 772 service_->GetEncryptedDataTypes(&encrypted_types);
773 if (encrypted_types.count(type) > 0) 773 if (encrypted_types.count(type) > 0)
774 return true; 774 return true;
775 encrypted_types.insert(type); 775 encrypted_types.insert(type);
776 service_->EncryptDataTypes(encrypted_types); 776 service_->set_pending_types_for_encryption(encrypted_types);
777
778 // In order to kick off the encryption we have to reconfigure. Just grab the
779 // currently synced types and use them.
780 syncable::ModelTypeSet synced_datatypes;
781 service_->GetPreferredDataTypes(&synced_datatypes);
782 bool sync_everything = (synced_datatypes.size() ==
783 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE));
784 service_->OnUserChoseDatatypes(sync_everything,
785 synced_datatypes);
777 786
778 // Wait some time to let the enryption finish. 787 // Wait some time to let the enryption finish.
779 return WaitForTypeEncryption(type); 788 return WaitForTypeEncryption(type);
780 } 789 }
781 790
782 bool ProfileSyncServiceHarness::WaitForTypeEncryption( 791 bool ProfileSyncServiceHarness::WaitForTypeEncryption(
783 syncable::ModelType type) { 792 syncable::ModelType type) {
784 if (IsSynced() && 793 if (IsSynced() &&
785 IsTypeEncrypted(type) && 794 IsTypeEncrypted(type) &&
786 GetLastSessionSnapshot()->num_conflicting_updates == 0) { 795 GetLastSessionSnapshot()->num_conflicting_updates == 0) {
(...skipping 22 matching lines...) Expand all
809 return true; 818 return true;
810 } 819 }
811 820
812 std::string ProfileSyncServiceHarness::GetServiceStatus() { 821 std::string ProfileSyncServiceHarness::GetServiceStatus() {
813 DictionaryValue value; 822 DictionaryValue value;
814 sync_ui_util::ConstructAboutInformation(service_, &value); 823 sync_ui_util::ConstructAboutInformation(service_, &value);
815 std::string service_status; 824 std::string service_status;
816 base::JSONWriter::Write(&value, true, &service_status); 825 base::JSONWriter::Write(&value, true, &service_status);
817 return service_status; 826 return service_status;
818 } 827 }
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