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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 9956097: suppress user/password dialog when re-enabling sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 5257b6a8d80ae2b68c6bda3994bf83895148dcf1..dc70f86ab731c28853627de3cb07812120173c2e 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -201,6 +201,7 @@ void ProfileSyncService::Initialize() {
}
void ProfileSyncService::TryStart() {
+ LOG(WARNING) << "TryStart";
if (!sync_prefs_.IsStartSuppressed() && AreCredentialsAvailable()) {
if (HasSyncSetupCompleted() || auto_start_enabled_) {
// If sync setup has completed we always start the backend.
@@ -220,6 +221,8 @@ void ProfileSyncService::TryStart() {
// trigger an unrecoverable error.
OnUnrecoverableError(FROM_HERE, "Sync credentials lost.");
}
+ } else {
+ LOG(WARNING) << "TryStart: did nothing.";
}
}
@@ -332,6 +335,7 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) {
new browser_sync::BackendUnrecoverableErrorHandler(
MakeWeakHandle(AsWeakPtr())));
+ LOG(WARNING) << "Initializing backend";
backend_->Initialize(
this,
MakeWeakHandle(sync_js_controller_.AsWeakPtr()),
@@ -344,6 +348,7 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) {
}
void ProfileSyncService::CreateBackend() {
+ LOG(WARNING) << "CreateBackend";
backend_.reset(
new SyncBackendHost(profile_->GetDebugName(),
profile_, sync_prefs_.AsWeakPtr()));
@@ -619,6 +624,7 @@ void ProfileSyncService::OnDisableDatatype(
void ProfileSyncService::OnBackendInitialized(
const WeakHandle<JsBackend>& js_backend, bool success) {
+ LOG(WARNING) << "OnBackendInitialized() : " << success;
if (!HasSyncSetupCompleted()) {
UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success);
} else {
@@ -665,6 +671,7 @@ void ProfileSyncService::OnBackendInitialized(
}
void ProfileSyncService::OnSyncCycleCompleted() {
+ LOG(WARNING) << "OnSyncCycleCompleted";
UpdateLastSyncedTime();
if (GetSessionModelAssociator()) {
// Trigger garbage collection of old sessions now that we've downloaded
@@ -777,10 +784,12 @@ GoogleServiceAuthError ConnectionStatusToAuthError(
void ProfileSyncService::OnConnectionStatusChange(
sync_api::ConnectionStatus status) {
+ LOG(WARNING) << "OnConnectionStatusChange";
UpdateAuthErrorState(ConnectionStatusToAuthError(status));
}
void ProfileSyncService::OnStopSyncingPermanently() {
+ LOG(WARNING) << "OnStopSyncingPermanently";
UpdateAuthErrorState(
GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE));
sync_prefs_.SetStartSuppressed(true);
@@ -788,6 +797,7 @@ void ProfileSyncService::OnStopSyncingPermanently() {
}
void ProfileSyncService::OnClearServerDataTimeout() {
+ LOG(WARNING) << "OnClearServerDataTimeout";
if (clear_server_data_state_ != CLEAR_SUCCEEDED &&
clear_server_data_state_ != CLEAR_FAILED) {
clear_server_data_state_ = CLEAR_FAILED;
@@ -796,6 +806,7 @@ void ProfileSyncService::OnClearServerDataTimeout() {
}
void ProfileSyncService::OnClearServerDataFailed() {
+ LOG(WARNING) << "OnClearServerDataFailed";
clear_server_data_timer_.Stop();
// Only once clear has succeeded there is no longer a need to transition to
@@ -809,6 +820,7 @@ void ProfileSyncService::OnClearServerDataFailed() {
}
void ProfileSyncService::OnClearServerDataSucceeded() {
+ LOG(WARNING) << "OnClearServerDataSucceeded";
clear_server_data_timer_.Stop();
// Even if the timout fired, we still transition to the succeeded state as
@@ -822,6 +834,7 @@ void ProfileSyncService::OnClearServerDataSucceeded() {
void ProfileSyncService::OnPassphraseRequired(
sync_api::PassphraseRequiredReason reason,
const sync_pb::EncryptedData& pending_keys) {
+ LOG(WARNING) << "OnPassphraseRequired";
DCHECK(backend_.get());
DCHECK(backend_->IsNigoriEnabled());
@@ -841,6 +854,7 @@ void ProfileSyncService::OnPassphraseRequired(
}
void ProfileSyncService::OnPassphraseAccepted() {
+ LOG(WARNING) << "OnPassphraseAccepted";
DVLOG(1) << "Received OnPassphraseAccepted.";
// If we are not using an explicit passphrase, and we have a cache of the gaia
// password, use it for encryption at this point.
@@ -879,6 +893,7 @@ void ProfileSyncService::OnEncryptedTypesChanged(
}
void ProfileSyncService::OnEncryptionComplete() {
+ LOG(WARNING) << "OnEncryptionComplete";
DVLOG(1) << "Encryption complete";
if (encryption_pending_ && encrypt_everything_) {
encryption_pending_ = false;
@@ -899,6 +914,7 @@ void ProfileSyncService::OnMigrationNeededForTypes(
}
void ProfileSyncService::OnActionableError(const SyncProtocolError& error) {
+ LOG(WARNING) << "OnActionableError";
last_actionable_error_ = error;
DCHECK_NE(last_actionable_error_.action,
browser_sync::UNKNOWN_ACTION);
@@ -1437,6 +1453,7 @@ void ProfileSyncService::Observe(int type,
break;
}
case chrome::NOTIFICATION_TOKEN_REQUEST_FAILED: {
+ LOG(WARNING) << "Got NOTIFICATION_TOKEN_REQUEST_FAILED";
const TokenService::TokenRequestFailedDetails& token_details =
*(content::Details<const TokenService::TokenRequestFailedDetails>(
details).ptr());
@@ -1448,6 +1465,7 @@ void ProfileSyncService::Observe(int type,
break;
}
case chrome::NOTIFICATION_TOKEN_AVAILABLE: {
+ LOG(WARNING) << "Got NOTIFICATION_TOKEN_AVAILABLE";
const TokenService::TokenAvailableDetails& token_details =
*(content::Details<const TokenService::TokenAvailableDetails>(
details).ptr());
@@ -1461,6 +1479,7 @@ void ProfileSyncService::Observe(int type,
break;
}
case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: {
+ LOG(WARNING) << "Got NOTIFICATION_TOKEN_LOADING_FINISHED";
// This notification gets fired when TokenService loads the tokens
// from storage.
if (AreCredentialsAvailable()) {
@@ -1535,9 +1554,15 @@ void ProfileSyncService::StopAndSuppress() {
ShutdownImpl(false);
}
-void ProfileSyncService::UnsuppressAndStart() {
+void ProfileSyncService::Unsuppress() {
+ LOG(WARNING) << "Unsuppress()";
DCHECK(profile_);
sync_prefs_.SetStartSuppressed(false);
+}
+
+void ProfileSyncService::UnsuppressAndStart() {
+ LOG(WARNING) << "UnsuppressAndStart()";
+ Unsuppress();
// Set username in SigninManager, as SigninManager::OnGetUserInfoSuccess
// is never called for some clients.
if (signin_ && signin_->GetAuthenticatedUsername().empty()) {

Powered by Google App Engine
This is Rietveld 408576698