| 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 #ifdef CHROME_PERSONALIZATION | 5 #ifdef CHROME_PERSONALIZATION |
| 6 #include "chrome/browser/sync/profile_sync_service.h" | 6 #include "chrome/browser/sync/profile_sync_service.h" |
| 7 | 7 |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 model_associator_ = NULL; | 144 model_associator_ = NULL; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Clear various flags. | 147 // Clear various flags. |
| 148 is_auth_in_progress_ = false; | 148 is_auth_in_progress_ = false; |
| 149 backend_initialized_ = false; | 149 backend_initialized_ = false; |
| 150 expecting_first_run_auth_needed_event_ = false; | 150 expecting_first_run_auth_needed_event_ = false; |
| 151 last_attempted_user_email_.clear(); | 151 last_attempted_user_email_.clear(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ProfileSyncService::EnableForUser() { | 154 void ProfileSyncService::EnableForUser(gfx::NativeWindow parent_window) { |
| 155 if (WizardIsVisible()) { | 155 if (WizardIsVisible()) { |
| 156 // TODO(timsteele): Focus wizard. | 156 // TODO(timsteele): Focus wizard. |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 wizard_parent_window_ = parent_window; |
| 159 expecting_first_run_auth_needed_event_ = true; | 160 expecting_first_run_auth_needed_event_ = true; |
| 160 | 161 |
| 161 StartUp(); | 162 StartUp(); |
| 162 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 163 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void ProfileSyncService::DisableForUser() { | 166 void ProfileSyncService::DisableForUser() { |
| 166 if (WizardIsVisible()) { | 167 if (WizardIsVisible()) { |
| 167 // TODO(timsteele): Focus wizard. | 168 // TODO(timsteele): Focus wizard. |
| 168 return; | 169 return; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 UMA_HISTOGRAM_TIMES("Sync.AuthorizationTimeInNetwork", | 260 UMA_HISTOGRAM_TIMES("Sync.AuthorizationTimeInNetwork", |
| 260 base::TimeTicks::Now() - auth_start_time_); | 261 base::TimeTicks::Now() - auth_start_time_); |
| 261 auth_start_time_ = base::TimeTicks(); | 262 auth_start_time_ = base::TimeTicks(); |
| 262 } | 263 } |
| 263 | 264 |
| 264 is_auth_in_progress_ = false; | 265 is_auth_in_progress_ = false; |
| 265 // Fan the notification out to interested UI-thread components. | 266 // Fan the notification out to interested UI-thread components. |
| 266 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); | 267 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); |
| 267 } | 268 } |
| 268 | 269 |
| 269 void ProfileSyncService::ShowLoginDialog() { | 270 void ProfileSyncService::ShowLoginDialog(gfx::NativeWindow parent_window) { |
| 270 if (WizardIsVisible()) | 271 if (WizardIsVisible()) |
| 271 return; | 272 return; |
| 272 | 273 |
| 274 wizard_parent_window_ = parent_window; |
| 275 |
| 273 if (!auth_error_time_.is_null()) { | 276 if (!auth_error_time_.is_null()) { |
| 274 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", | 277 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", |
| 275 base::TimeTicks::Now() - auth_error_time_); | 278 base::TimeTicks::Now() - auth_error_time_); |
| 276 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. | 279 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. |
| 277 } | 280 } |
| 278 | 281 |
| 279 if (last_auth_error_ != AUTH_ERROR_NONE) { | 282 if (last_auth_error_ != AUTH_ERROR_NONE) { |
| 280 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); | 283 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); |
| 281 } | 284 } |
| 282 } | 285 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 425 } |
| 423 | 426 |
| 424 bool ProfileSyncService::ShouldPushChanges() { | 427 bool ProfileSyncService::ShouldPushChanges() { |
| 425 // True only after all bootstrapping has succeeded: the bookmark model is | 428 // True only after all bootstrapping has succeeded: the bookmark model is |
| 426 // loaded, the sync backend is initialized, the two domains are | 429 // loaded, the sync backend is initialized, the two domains are |
| 427 // consistent with one another, and no unrecoverable error has transpired. | 430 // consistent with one another, and no unrecoverable error has transpired. |
| 428 return change_processor_->IsRunning(); | 431 return change_processor_->IsRunning(); |
| 429 } | 432 } |
| 430 | 433 |
| 431 #endif // CHROME_PERSONALIZATION | 434 #endif // CHROME_PERSONALIZATION |
| OLD | NEW |