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

Side by Side Diff: chrome/browser/sync/sync_ui_util.cc

Issue 8391034: Remove sync error button from bookmark bar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 if (auth_error.state() != AuthError::NONE) { 385 if (auth_error.state() != AuthError::NONE) {
386 GetStatusLabelsForAuthError(auth_error, *service, NULL, NULL, 386 GetStatusLabelsForAuthError(auth_error, *service, NULL, NULL,
387 menu_label, bubble_message, bubble_accept_label); 387 menu_label, bubble_message, bubble_accept_label);
388 } 388 }
389 } 389 }
390 390
391 MessageType GetStatus(ProfileSyncService* service) { 391 MessageType GetStatus(ProfileSyncService* service) {
392 return sync_ui_util::GetStatusInfo(service, NULL, NULL); 392 return sync_ui_util::GetStatusInfo(service, NULL, NULL);
393 } 393 }
394 394
395 bool ShouldShowSyncErrorButton(ProfileSyncService* service) {
396 if (!service)
397 return false;
398
399 if (service->IsManaged() || !service->HasSyncSetupCompleted())
400 return false;
401
402 // Don't display error button for unrecoverable errors; they are not
403 // actionable.
404 if (service->unrecoverable_error_detected())
405 return false;
406
407 return GetStatus(service) == sync_ui_util::SYNC_ERROR ||
408 service->IsPassphraseRequired();
409 }
410
411 string16 GetSyncMenuLabel(ProfileSyncService* service) { 395 string16 GetSyncMenuLabel(ProfileSyncService* service) {
412 MessageType type = GetStatus(service); 396 MessageType type = GetStatus(service);
413 397
414 if (type == sync_ui_util::SYNCED) 398 if (type == sync_ui_util::SYNCED)
415 return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNCED_LABEL); 399 return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNCED_LABEL);
416 else if (type == sync_ui_util::SYNC_ERROR) 400 else if (type == sync_ui_util::SYNC_ERROR)
417 return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNC_ERROR_LABEL); 401 return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNC_ERROR_LABEL);
418 else 402 else
419 return l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); 403 return l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
420 } 404 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 DictionaryValue* val = new DictionaryValue; 657 DictionaryValue* val = new DictionaryValue;
674 val->SetString("model_type", ModelTypeToString(it->first)); 658 val->SetString("model_type", ModelTypeToString(it->first));
675 val->SetString("group", ModelSafeGroupToString(it->second)); 659 val->SetString("group", ModelSafeGroupToString(it->second));
676 routing_info->Append(val); 660 routing_info->Append(val);
677 } 661 }
678 } 662 }
679 } 663 }
680 } 664 }
681 665
682 } // namespace sync_ui_util 666 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698