summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 22:27:39 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 22:27:39 +0000
commit06eee70c5530309d7e17f47e5297c7218fa0a5f1 (patch)
tree87272869ba78f9bdde7c6b0835b07cf7c43a064a /chrome/browser/sync
parent8f1a633e90ac9bf4f959baeff321e35d5e031830 (diff)
downloadchromium_src-06eee70c5530309d7e17f47e5297c7218fa0a5f1.zip
chromium_src-06eee70c5530309d7e17f47e5297c7218fa0a5f1.tar.gz
chromium_src-06eee70c5530309d7e17f47e5297c7218fa0a5f1.tar.bz2
sync: Add two functions to sync_ui_util header and update the callers accordingly.
* ShouldShowSyncErrorButton: added. * GetSyncMenuLabel: added. (original code review: http://codereview.chromium.org/501142 , patch by thiago.farina@gmail.com ) Review URL: http://codereview.chromium.org/519069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/sync_ui_util.cc16
-rw-r--r--chrome/browser/sync/sync_ui_util.h9
2 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc
index c82482a..5edd4db 100644
--- a/chrome/browser/sync/sync_ui_util.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -160,6 +160,22 @@ MessageType GetStatus(ProfileSyncService* service) {
return sync_ui_util::GetStatusInfo(service, NULL, NULL);
}
+bool ShouldShowSyncErrorButton(ProfileSyncService* service) {
+ return service && service->HasSyncSetupCompleted() &&
+ (GetStatus(service) == sync_ui_util::SYNC_ERROR);
+}
+
+string16 GetSyncMenuLabel(ProfileSyncService* service) {
+ MessageType type = GetStatus(service);
+
+ if (type == sync_ui_util::SYNCED)
+ return l10n_util::GetStringUTF16(IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL);
+ else if (type == sync_ui_util::SYNC_ERROR)
+ return l10n_util::GetStringUTF16(IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL);
+ else
+ return l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
+}
+
void OpenSyncMyBookmarksDialog(
Profile* profile, ProfileSyncService::SyncEventCodes code) {
ProfileSyncService* service =
diff --git a/chrome/browser/sync/sync_ui_util.h b/chrome/browser/sync/sync_ui_util.h
index 53f0036..0b9483e 100644
--- a/chrome/browser/sync/sync_ui_util.h
+++ b/chrome/browser/sync/sync_ui_util.h
@@ -20,6 +20,9 @@ enum MessageType {
SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
};
+// TODO(akalin): audit the use of ProfileSyncService* service below,
+// and use const ProfileSyncService& service where possible.
+
// Create status and link labels for the current status labels and link text
// by querying |service|.
MessageType GetStatusLabels(ProfileSyncService* service,
@@ -28,6 +31,12 @@ MessageType GetStatusLabels(ProfileSyncService* service,
MessageType GetStatus(ProfileSyncService* service);
+// Determines whether or not the sync error button should be visible.
+bool ShouldShowSyncErrorButton(ProfileSyncService* service);
+
+// Returns a string with the synchronization status.
+string16 GetSyncMenuLabel(ProfileSyncService* service);
+
// Open the appropriate sync dialog for the given profile (which can be
// incognito). |code| should be one of the START_FROM_* codes.
void OpenSyncMyBookmarksDialog(