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/sync/sync_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 | 333 |
334 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, | 334 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, |
335 string16* status_label, | 335 string16* status_label, |
336 string16* link_label) { | 336 string16* link_label) { |
337 DCHECK(status_label); | 337 DCHECK(status_label); |
338 DCHECK(link_label); | 338 DCHECK(link_label); |
339 return sync_ui_util::GetStatusInfoForNewTabPage( | 339 return sync_ui_util::GetStatusInfoForNewTabPage( |
340 service, status_label, link_label); | 340 service, status_label, link_label); |
341 } | 341 } |
342 | 342 |
343 MessageType GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, | 343 void GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, |
344 string16* menu_label, | 344 string16* menu_label, |
345 string16* bubble_message, | 345 string16* bubble_message, |
346 string16* bubble_accept_label) { | 346 string16* bubble_accept_label) { |
347 DCHECK(menu_label); | |
348 DCHECK(bubble_message); | |
349 DCHECK(bubble_accept_label); | |
350 | |
Andrew T Wilson (Slow)
2011/10/17 04:08:55
Since we aren't returning MessageType any more, I
sail
2011/10/17 15:21:22
Done.
| |
347 if (!service->HasSyncSetupCompleted()) | 351 if (!service->HasSyncSetupCompleted()) |
348 return PRE_SYNCED; | 352 return; |
349 | 353 |
350 if (service->IsPassphraseRequired() && | 354 if (service->IsPassphraseRequired() && |
351 service->IsPassphraseRequiredForDecryption()) { | 355 service->IsPassphraseRequiredForDecryption()) { |
352 // This is not the first machine so ask user to enter passphrase. | 356 // This is not the first machine so ask user to enter passphrase. |
353 if (menu_label) { | 357 *menu_label = l10n_util::GetStringUTF16( |
354 *menu_label = l10n_util::GetStringUTF16( | 358 IDS_SYNC_PASSPHRASE_ERROR_WRENCH_MENU_ITEM); |
355 IDS_SYNC_PASSPHRASE_ERROR_WRENCH_MENU_ITEM); | 359 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
356 } | 360 *bubble_message = l10n_util::GetStringFUTF16( |
357 if (bubble_message) { | 361 IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE, product_name); |
358 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 362 *bubble_accept_label = l10n_util::GetStringUTF16( |
359 *bubble_message = l10n_util::GetStringFUTF16( | 363 IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_ACCEPT); |
360 IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE, product_name); | 364 return; |
361 } | |
362 if (bubble_accept_label) { | |
363 *bubble_accept_label = l10n_util::GetStringUTF16( | |
364 IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_ACCEPT); | |
365 } | |
366 return SYNC_ERROR; | |
367 } | 365 } |
368 | 366 |
369 MessageType status = GetStatus(service); | 367 MessageType status = GetStatus(service); |
370 if (status != SYNC_ERROR) | 368 if (status != SYNC_ERROR) |
371 return status; | 369 return; |
372 | 370 |
373 const AuthError& auth_error = service->GetAuthError(); | 371 const AuthError& auth_error = service->GetAuthError(); |
374 if (auth_error.state() != AuthError::NONE) { | 372 if (auth_error.state() != AuthError::NONE) { |
375 GetStatusLabelsForAuthError(auth_error, *service, NULL, NULL, | 373 GetStatusLabelsForAuthError(auth_error, *service, NULL, NULL, |
376 menu_label, bubble_message, bubble_accept_label); | 374 menu_label, bubble_message, bubble_accept_label); |
377 return SYNC_ERROR; | |
378 } | 375 } |
379 | |
380 return SYNCED; | |
381 } | 376 } |
382 | 377 |
383 MessageType GetStatus(ProfileSyncService* service) { | 378 MessageType GetStatus(ProfileSyncService* service) { |
384 return sync_ui_util::GetStatusInfo(service, NULL, NULL); | 379 return sync_ui_util::GetStatusInfo(service, NULL, NULL); |
385 } | 380 } |
386 | 381 |
387 bool ShouldShowSyncErrorButton(ProfileSyncService* service) { | 382 bool ShouldShowSyncErrorButton(ProfileSyncService* service) { |
388 return service && | 383 return service && |
389 ((!service->IsManaged() && | 384 ((!service->IsManaged() && |
390 service->HasSyncSetupCompleted()) && | 385 service->HasSyncSetupCompleted()) && |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 DictionaryValue* val = new DictionaryValue; | 652 DictionaryValue* val = new DictionaryValue; |
658 val->SetString("model_type", ModelTypeToString(it->first)); | 653 val->SetString("model_type", ModelTypeToString(it->first)); |
659 val->SetString("group", ModelSafeGroupToString(it->second)); | 654 val->SetString("group", ModelSafeGroupToString(it->second)); |
660 routing_info->Append(val); | 655 routing_info->Append(val); |
661 } | 656 } |
662 } | 657 } |
663 } | 658 } |
664 } | 659 } |
665 | 660 |
666 } // namespace sync_ui_util | 661 } // namespace sync_ui_util |
OLD | NEW |