| OLD | NEW |
| 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/ui/webui/options/personal_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/personal_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void PersonalOptionsHandler::OnStateChanged() { | 232 void PersonalOptionsHandler::OnStateChanged() { |
| 233 string16 status_label; | 233 string16 status_label; |
| 234 string16 link_label; | 234 string16 link_label; |
| 235 ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService(); | 235 ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService(); |
| 236 DCHECK(service); | 236 DCHECK(service); |
| 237 bool managed = service->IsManaged(); | 237 bool managed = service->IsManaged(); |
| 238 bool sync_setup_completed = service->HasSyncSetupCompleted(); | 238 bool sync_setup_completed = service->HasSyncSetupCompleted(); |
| 239 bool status_has_error = sync_ui_util::GetStatusLabels(service, | 239 bool status_has_error = sync_ui_util::GetStatusLabels( |
| 240 &status_label, &link_label) == sync_ui_util::SYNC_ERROR; | 240 service, &status_label, &link_label) == sync_ui_util::SYNC_ERROR; |
| 241 browser_sync::SyncBackendHost::StatusSummary summary = |
| 242 service->QuerySyncStatusSummary(); |
| 243 |
| 244 if (!status_has_error && |
| 245 summary == browser_sync::SyncBackendHost::Status::SYNCING) { |
| 246 string16 user_name(service->GetAuthenticatedUsername()); |
| 247 status_label.assign(l10n_util::GetStringFUTF16( |
| 248 IDS_SYNC_ACCOUNT_SYNCING_TO_USER, |
| 249 user_name, |
| 250 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL))); |
| 251 } |
| 241 | 252 |
| 242 string16 start_stop_button_label; | 253 string16 start_stop_button_label; |
| 243 bool is_start_stop_button_visible = false; | 254 bool is_start_stop_button_visible = false; |
| 244 bool is_start_stop_button_enabled = false; | 255 bool is_start_stop_button_enabled = false; |
| 245 if (sync_setup_completed) { | 256 if (sync_setup_completed) { |
| 246 start_stop_button_label = multiprofile_ ? | 257 start_stop_button_label = multiprofile_ ? |
| 247 l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON_LABEL) : | 258 l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON_LABEL) : |
| 248 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); | 259 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); |
| 249 #if defined(OS_CHROMEOS) | 260 #if defined(OS_CHROMEOS) |
| 250 is_start_stop_button_visible = false; | 261 is_start_stop_button_visible = false; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 StringPrintf("%s%s?id=%lld", | 426 StringPrintf("%s%s?id=%lld", |
| 416 chrome::kChromeUIUserImageURL, | 427 chrome::kChromeUIUserImageURL, |
| 417 email.c_str(), | 428 email.c_str(), |
| 418 timestamp)); | 429 timestamp)); |
| 419 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", | 430 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", |
| 420 image_url); | 431 image_url); |
| 421 } | 432 } |
| 422 } | 433 } |
| 423 | 434 |
| 424 #endif | 435 #endif |
| OLD | NEW |