[email protected] | 40f04797 | 2009-11-25 03:54:40 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| 6 | #define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| 7 | |
| 8 | #include "base/string16.h" |
| 9 | #include "chrome/browser/sync/profile_sync_service.h" |
| 10 | |
| 11 | class Profile; |
| 12 | |
| 13 | // Utility functions to gather current sync status information from the sync |
| 14 | // service and constructs messages suitable for showing in UI. |
| 15 | namespace sync_ui_util { |
| 16 | |
| 17 | enum MessageType { |
| 18 | PRE_SYNCED, // User has not set up sync. |
| 19 | SYNCED, // We are synced and authenticated to a gmail account. |
| 20 | SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. |
| 21 | }; |
| 22 | |
[email protected] | 06eee70c | 2010-01-06 22:27:39 | [diff] [blame^] | 23 | // TODO(akalin): audit the use of ProfileSyncService* service below, |
| 24 | // and use const ProfileSyncService& service where possible. |
| 25 | |
[email protected] | 40f04797 | 2009-11-25 03:54:40 | [diff] [blame] | 26 | // Create status and link labels for the current status labels and link text |
| 27 | // by querying |service|. |
| 28 | MessageType GetStatusLabels(ProfileSyncService* service, |
| 29 | string16* status_label, |
| 30 | string16* link_label); |
| 31 | |
[email protected] | 5c086d7 | 2009-12-14 20:49:04 | [diff] [blame] | 32 | MessageType GetStatus(ProfileSyncService* service); |
| 33 | |
[email protected] | 06eee70c | 2010-01-06 22:27:39 | [diff] [blame^] | 34 | // Determines whether or not the sync error button should be visible. |
| 35 | bool ShouldShowSyncErrorButton(ProfileSyncService* service); |
| 36 | |
| 37 | // Returns a string with the synchronization status. |
| 38 | string16 GetSyncMenuLabel(ProfileSyncService* service); |
| 39 | |
[email protected] | 40f04797 | 2009-11-25 03:54:40 | [diff] [blame] | 40 | // Open the appropriate sync dialog for the given profile (which can be |
| 41 | // incognito). |code| should be one of the START_FROM_* codes. |
| 42 | void OpenSyncMyBookmarksDialog( |
| 43 | Profile* profile, ProfileSyncService::SyncEventCodes code); |
| 44 | } // namespace sync_ui_util |
| 45 | |
| 46 | #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| 47 | |