OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return l10n_util::GetString(IDS_SYNC_TIME_JUST_NOW); | 322 return l10n_util::GetString(IDS_SYNC_TIME_JUST_NOW); |
323 | 323 |
324 return TimeFormat::TimeElapsed(last_synced); | 324 return TimeFormat::TimeElapsed(last_synced); |
325 } | 325 } |
326 | 326 |
327 string16 ProfileSyncService::GetAuthenticatedUsername() const { | 327 string16 ProfileSyncService::GetAuthenticatedUsername() const { |
328 return backend_->GetAuthenticatedUsername(); | 328 return backend_->GetAuthenticatedUsername(); |
329 } | 329 } |
330 | 330 |
331 void ProfileSyncService::OnUserSubmittedAuth( | 331 void ProfileSyncService::OnUserSubmittedAuth( |
332 const std::string& username, const std::string& password) { | 332 const std::string& username, const std::string& password, |
| 333 const std::string& captcha) { |
333 last_attempted_user_email_ = username; | 334 last_attempted_user_email_ = username; |
334 is_auth_in_progress_ = true; | 335 is_auth_in_progress_ = true; |
335 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 336 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
336 | 337 |
337 auth_start_time_ = base::TimeTicks::Now(); | 338 auth_start_time_ = base::TimeTicks::Now(); |
338 backend_->Authenticate(username, password); | 339 backend_->Authenticate(username, password, captcha); |
339 } | 340 } |
340 | 341 |
341 void ProfileSyncService::OnUserAcceptedMergeAndSync() { | 342 void ProfileSyncService::OnUserAcceptedMergeAndSync() { |
342 base::TimeTicks start_time = base::TimeTicks::Now(); | 343 base::TimeTicks start_time = base::TimeTicks::Now(); |
343 bool not_first_run = model_associator_->SyncModelHasUserCreatedNodes(); | 344 bool not_first_run = model_associator_->SyncModelHasUserCreatedNodes(); |
344 bool merge_success = model_associator_->AssociateModels(); | 345 bool merge_success = model_associator_->AssociateModels(); |
345 UMA_HISTOGRAM_MEDIUM_TIMES("Sync.UserPerceivedBookmarkAssociation", | 346 UMA_HISTOGRAM_MEDIUM_TIMES("Sync.UserPerceivedBookmarkAssociation", |
346 base::TimeTicks::Now() - start_time); | 347 base::TimeTicks::Now() - start_time); |
347 if (!merge_success) { | 348 if (!merge_success) { |
348 LOG(ERROR) << "Model association failed."; | 349 LOG(ERROR) << "Model association failed."; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 histogram.SetFlags(kUmaTargetedHistogramFlag); | 423 histogram.SetFlags(kUmaTargetedHistogramFlag); |
423 histogram.Add(code); | 424 histogram.Add(code); |
424 } | 425 } |
425 | 426 |
426 bool ProfileSyncService::ShouldPushChanges() { | 427 bool ProfileSyncService::ShouldPushChanges() { |
427 // True only after all bootstrapping has succeeded: the bookmark model is | 428 // True only after all bootstrapping has succeeded: the bookmark model is |
428 // loaded, the sync backend is initialized, the two domains are | 429 // loaded, the sync backend is initialized, the two domains are |
429 // consistent with one another, and no unrecoverable error has transpired. | 430 // consistent with one another, and no unrecoverable error has transpired. |
430 return change_processor_->IsRunning(); | 431 return change_processor_->IsRunning(); |
431 } | 432 } |
OLD | NEW |