| OLD | NEW |
| 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/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 LOG(ERROR) << "SetupSync(): service_ is null."; | 164 LOG(ERROR) << "SetupSync(): service_ is null."; |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Subscribe sync client to notifications from the profile sync service. | 168 // Subscribe sync client to notifications from the profile sync service. |
| 169 if (!service_->HasObserver(this)) | 169 if (!service_->HasObserver(this)) |
| 170 service_->AddObserver(this); | 170 service_->AddObserver(this); |
| 171 | 171 |
| 172 // Tell the sync service that setup is in progress so we don't start syncing | 172 // Tell the sync service that setup is in progress so we don't start syncing |
| 173 // until we've finished configuration. | 173 // until we've finished configuration. |
| 174 service_->set_setup_in_progress(true); | 174 service_->SetSetupInProgress(true); |
| 175 | 175 |
| 176 // Authenticate sync client using GAIA credentials. | 176 // Authenticate sync client using GAIA credentials. |
| 177 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 177 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 178 switches::kDisableClientOAuthSignin)) { | 178 switches::kDisableClientOAuthSignin)) { |
| 179 service_->signin()->StartSignInWithOAuth(username_, password_); | 179 service_->signin()->StartSignInWithOAuth(username_, password_); |
| 180 } else { | 180 } else { |
| 181 service_->signin()->StartSignIn(username_, password_, "", ""); | 181 service_->signin()->StartSignIn(username_, password_, "", ""); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Wait for the OnBackendInitialized() callback. | 184 // Wait for the OnBackendInitialized() callback. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Make sure that initial sync wasn't blocked by a missing passphrase. | 233 // Make sure that initial sync wasn't blocked by a missing passphrase. |
| 234 if (wait_state_ == SET_PASSPHRASE_FAILED) { | 234 if (wait_state_ == SET_PASSPHRASE_FAILED) { |
| 235 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed" | 235 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed" |
| 236 " until SetDecryptionPassphrase is called."; | 236 " until SetDecryptionPassphrase is called."; |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| 240 // Notify ProfileSyncService that we are done with configuration. | 240 // Notify ProfileSyncService that we are done with configuration. |
| 241 service_->set_setup_in_progress(false); | 241 service_->SetSetupInProgress(false); |
| 242 | 242 |
| 243 // Indicate to the browser that sync setup is complete. | 243 // Indicate to the browser that sync setup is complete. |
| 244 service()->SetSyncSetupCompleted(); | 244 service()->SetSyncSetupCompleted(); |
| 245 | 245 |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool ProfileSyncServiceHarness::TryListeningToMigrationEvents() { | 249 bool ProfileSyncServiceHarness::TryListeningToMigrationEvents() { |
| 250 browser_sync::BackendMigrator* migrator = | 250 browser_sync::BackendMigrator* migrator = |
| 251 service_->GetBackendMigratorForTest(); | 251 service_->GetBackendMigratorForTest(); |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1104 |
| 1105 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1105 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1106 DictionaryValue value; | 1106 DictionaryValue value; |
| 1107 sync_ui_util::ConstructAboutInformation(service_, &value); | 1107 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1108 std::string service_status; | 1108 std::string service_status; |
| 1109 base::JSONWriter::WriteWithOptions(&value, | 1109 base::JSONWriter::WriteWithOptions(&value, |
| 1110 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1110 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1111 &service_status); | 1111 &service_status); |
| 1112 return service_status; | 1112 return service_status; |
| 1113 } | 1113 } |
| OLD | NEW |