| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 class SigninManagerBase; |
| 13 |
| 14 namespace browser_sync { |
| 12 class ProfileSyncService; | 15 class ProfileSyncService; |
| 13 class SigninManagerBase; | 16 } // namespace browser_sync |
| 14 | 17 |
| 15 // Utility functions to gather current sync status information from the sync | 18 // Utility functions to gather current sync status information from the sync |
| 16 // service and constructs messages suitable for showing in UI. | 19 // service and constructs messages suitable for showing in UI. |
| 17 namespace sync_ui_util { | 20 namespace sync_ui_util { |
| 18 | 21 |
| 19 enum MessageType { | 22 enum MessageType { |
| 20 PRE_SYNCED, // User has not set up sync. | 23 PRE_SYNCED, // User has not set up sync. |
| 21 SYNCED, // We are synced and authenticated to a gmail account. | 24 SYNCED, // We are synced and authenticated to a gmail account. |
| 22 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. | 25 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. |
| 23 SYNC_PROMO, // A situation has occurred which should be brought to the user's | 26 SYNC_PROMO, // A situation has occurred which should be brought to the user's |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 PASSPHRASE_ERROR // Sync passphrase error. | 43 PASSPHRASE_ERROR // Sync passphrase error. |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 // TODO(akalin): audit the use of ProfileSyncService* service below, | 46 // TODO(akalin): audit the use of ProfileSyncService* service below, |
| 44 // and use const ProfileSyncService& service where possible. | 47 // and use const ProfileSyncService& service where possible. |
| 45 | 48 |
| 46 // Create status and link labels for the current status labels and link text | 49 // Create status and link labels for the current status labels and link text |
| 47 // by querying |service|. | 50 // by querying |service|. |
| 48 // |style| sets the link properties, see |StatusLabelStyle|. | 51 // |style| sets the link properties, see |StatusLabelStyle|. |
| 49 MessageType GetStatusLabels(Profile* profile, | 52 MessageType GetStatusLabels(Profile* profile, |
| 50 ProfileSyncService* service, | 53 browser_sync::ProfileSyncService* service, |
| 51 const SigninManagerBase& signin, | 54 const SigninManagerBase& signin, |
| 52 StatusLabelStyle style, | 55 StatusLabelStyle style, |
| 53 base::string16* status_label, | 56 base::string16* status_label, |
| 54 base::string16* link_label); | 57 base::string16* link_label); |
| 55 | 58 |
| 56 // Same as above but for use specifically on the New Tab Page. | 59 // Same as above but for use specifically on the New Tab Page. |
| 57 // |status_label| may contain an HTML-formatted link. | 60 // |status_label| may contain an HTML-formatted link. |
| 58 MessageType GetStatusLabelsForNewTabPage(Profile* profile, | 61 MessageType GetStatusLabelsForNewTabPage( |
| 59 ProfileSyncService* service, | 62 Profile* profile, |
| 60 const SigninManagerBase& signin, | 63 browser_sync::ProfileSyncService* service, |
| 61 base::string16* status_label, | 64 const SigninManagerBase& signin, |
| 62 base::string16* link_label); | 65 base::string16* status_label, |
| 66 base::string16* link_label); |
| 63 | 67 |
| 64 #if !defined(OS_CHROMEOS) | 68 #if !defined(OS_CHROMEOS) |
| 65 // Gets various labels for the sync global error based on the sync error state. | 69 // Gets various labels for the sync global error based on the sync error state. |
| 66 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be | 70 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be |
| 67 // NULL. Note that we don't use SyncGlobalError on Chrome OS. | 71 // NULL. Note that we don't use SyncGlobalError on Chrome OS. |
| 68 void GetStatusLabelsForSyncGlobalError(const ProfileSyncService* service, | 72 void GetStatusLabelsForSyncGlobalError( |
| 69 base::string16* menu_item_label, | 73 const browser_sync::ProfileSyncService* service, |
| 70 base::string16* bubble_message, | 74 base::string16* menu_item_label, |
| 71 base::string16* bubble_accept_label); | 75 base::string16* bubble_message, |
| 76 base::string16* bubble_accept_label); |
| 72 | 77 |
| 73 // Gets the error message and button label for the sync errors that should be | 78 // Gets the error message and button label for the sync errors that should be |
| 74 // exposed to the user through the titlebar avatar button. | 79 // exposed to the user through the titlebar avatar button. |
| 75 AvatarSyncErrorType GetMessagesForAvatarSyncError(Profile* profile, | 80 AvatarSyncErrorType GetMessagesForAvatarSyncError(Profile* profile, |
| 76 int* content_string_id, | 81 int* content_string_id, |
| 77 int* button_string_id); | 82 int* button_string_id); |
| 78 #endif | 83 #endif |
| 79 | 84 |
| 80 MessageType GetStatus(Profile* profile, | 85 MessageType GetStatus(Profile* profile, |
| 81 ProfileSyncService* service, | 86 browser_sync::ProfileSyncService* service, |
| 82 const SigninManagerBase& signin); | 87 const SigninManagerBase& signin); |
| 83 | 88 |
| 84 } // namespace sync_ui_util | 89 } // namespace sync_ui_util |
| 85 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 90 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| OLD | NEW |