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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = | 235 ProfileSyncService* service = |
236 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); | 236 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); |
237 DCHECK(service); | 237 DCHECK(service); |
238 bool managed = service->IsManaged(); | 238 bool managed = service->IsManaged(); |
239 bool sync_setup_completed = service->HasSyncSetupCompleted(); | 239 bool sync_setup_completed = service->HasSyncSetupCompleted(); |
240 bool status_has_error = sync_ui_util::GetStatusLabels( | 240 bool status_has_error = sync_ui_util::GetStatusLabels( |
241 service, &status_label, &link_label) == sync_ui_util::SYNC_ERROR; | 241 service, &status_label, &link_label) == sync_ui_util::SYNC_ERROR; |
242 browser_sync::SyncBackendHost::StatusSummary summary = | |
243 service->QuerySyncStatusSummary(); | |
244 | |
245 // TODO(jhawkins): This is terribly hacky. Sync should pass us this state, but | |
246 // we have to fix the other callers of | |
247 // sync_ui_util::GetSyncedStateStatusLabel() to handle returned HTML. | |
248 if (!status_has_error && | |
249 summary == browser_sync::SyncBackendHost::Status::READY && | |
250 service->HasSyncSetupCompleted()) { | |
251 string16 user_name(service->GetAuthenticatedUsername()); | |
252 status_label.assign(l10n_util::GetStringFUTF16( | |
253 IDS_SYNC_ACCOUNT_SYNCING_TO_USER, | |
254 user_name, | |
255 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL))); | |
256 } | |
257 | 242 |
258 string16 start_stop_button_label; | 243 string16 start_stop_button_label; |
259 bool is_start_stop_button_visible = false; | 244 bool is_start_stop_button_visible = false; |
260 bool is_start_stop_button_enabled = false; | 245 bool is_start_stop_button_enabled = false; |
261 if (sync_setup_completed) { | 246 if (sync_setup_completed) { |
262 start_stop_button_label = | 247 start_stop_button_label = |
263 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); | 248 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); |
264 #if defined(OS_CHROMEOS) | 249 #if defined(OS_CHROMEOS) |
265 is_start_stop_button_visible = false; | 250 is_start_stop_button_visible = false; |
266 #else | 251 #else |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 profile_info_list.Append(profile_value); | 398 profile_info_list.Append(profile_value); |
414 } | 399 } |
415 | 400 |
416 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 401 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
417 profile_info_list); | 402 profile_info_list); |
418 } | 403 } |
419 | 404 |
420 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 405 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
421 ProfileManager::CreateMultiProfileAsync(); | 406 ProfileManager::CreateMultiProfileAsync(); |
422 } | 407 } |
OLD | NEW |