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

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

Issue 7492044: During SetupSync, check for missing passphrase before waiting for sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indent Created 9 years, 5 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 | « no previous file | no next file » | 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 << " seconds."; 167 << " seconds.";
168 return false; 168 return false;
169 } 169 }
170 170
171 // Choose the datatypes to be synced. If all datatypes are to be synced, 171 // Choose the datatypes to be synced. If all datatypes are to be synced,
172 // set sync_everything to true; otherwise, set it to false. 172 // set sync_everything to true; otherwise, set it to false.
173 bool sync_everything = (synced_datatypes.size() == 173 bool sync_everything = (synced_datatypes.size() ==
174 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE)); 174 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE));
175 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes); 175 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes);
176 176
177 // Make sure that a partner client hasn't already set an explicit passphrase.
178 if (wait_state_ == SET_PASSPHRASE_FAILED) {
179 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed"
180 " until SetPassphrase is called.";
181 return false;
182 }
183
177 // Wait for initial sync cycle to be completed. 184 // Wait for initial sync cycle to be completed.
178 DCHECK_EQ(wait_state_, WAITING_FOR_INITIAL_SYNC); 185 DCHECK_EQ(wait_state_, WAITING_FOR_INITIAL_SYNC);
179 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, 186 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs,
180 "Waiting for initial sync cycle to complete.")) { 187 "Waiting for initial sync cycle to complete.")) {
181 LOG(ERROR) << "Initial sync cycle did not complete after " 188 LOG(ERROR) << "Initial sync cycle did not complete after "
182 << kLiveSyncOperationTimeoutMs / 1000 189 << kLiveSyncOperationTimeoutMs / 1000
183 << " seconds."; 190 << " seconds.";
184 return false; 191 return false;
185 } 192 }
186 193
187 if (wait_state_ == SET_PASSPHRASE_FAILED) {
188 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed"
189 " until SetPassphrase is called.";
190 return false;
191 }
192
193 // Indicate to the browser that sync setup is complete. 194 // Indicate to the browser that sync setup is complete.
194 service()->SetSyncSetupCompleted(); 195 service()->SetSyncSetupCompleted();
195 196
196 return true; 197 return true;
197 } 198 }
198 199
199 void ProfileSyncServiceHarness::SignalStateCompleteWithNextState( 200 void ProfileSyncServiceHarness::SignalStateCompleteWithNextState(
200 WaitState next_state) { 201 WaitState next_state) {
201 wait_state_ = next_state; 202 wait_state_ = next_state;
202 SignalStateComplete(); 203 SignalStateComplete();
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return true; 809 return true;
809 } 810 }
810 811
811 std::string ProfileSyncServiceHarness::GetServiceStatus() { 812 std::string ProfileSyncServiceHarness::GetServiceStatus() {
812 DictionaryValue value; 813 DictionaryValue value;
813 sync_ui_util::ConstructAboutInformation(service_, &value); 814 sync_ui_util::ConstructAboutInformation(service_, &value);
814 std::string service_status; 815 std::string service_status;
815 base::JSONWriter::Write(&value, true, &service_status); 816 base::JSONWriter::Write(&value, true, &service_status);
816 return service_status; 817 return service_status;
817 } 818 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698