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/string16.h" | 8 #include "base/string16.h" |
9 | 9 |
10 class ProfileSyncService; | 10 class ProfileSyncService; |
11 class SigninManager; | 11 class SigninManagerBase; |
12 | 12 |
13 // Utility functions to gather current sync status information from the sync | 13 // Utility functions to gather current sync status information from the sync |
14 // service and constructs messages suitable for showing in UI. | 14 // service and constructs messages suitable for showing in UI. |
15 namespace sync_ui_util { | 15 namespace sync_ui_util { |
16 | 16 |
17 enum MessageType { | 17 enum MessageType { |
18 PRE_SYNCED, // User has not set up sync. | 18 PRE_SYNCED, // User has not set up sync. |
19 SYNCED, // We are synced and authenticated to a gmail account. | 19 SYNCED, // We are synced and authenticated to a gmail account. |
20 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. | 20 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. |
21 SYNC_PROMO, // A situation has occurred which should be brought to the user's | 21 SYNC_PROMO, // A situation has occurred which should be brought to the user's |
22 // attention, but not as an error. | 22 // attention, but not as an error. |
23 }; | 23 }; |
24 | 24 |
25 enum StatusLabelStyle { | 25 enum StatusLabelStyle { |
26 PLAIN_TEXT, // Label will be plain-text only. | 26 PLAIN_TEXT, // Label will be plain-text only. |
27 WITH_HTML // Label may contain an HTML-formatted link. | 27 WITH_HTML // Label may contain an HTML-formatted link. |
28 }; | 28 }; |
29 | 29 |
30 // TODO(akalin): audit the use of ProfileSyncService* service below, | 30 // TODO(akalin): audit the use of ProfileSyncService* service below, |
31 // and use const ProfileSyncService& service where possible. | 31 // and use const ProfileSyncService& service where possible. |
32 | 32 |
33 // Create status and link labels for the current status labels and link text | 33 // Create status and link labels for the current status labels and link text |
34 // by querying |service|. | 34 // by querying |service|. |
35 // |style| sets the link properties, see |StatusLabelStyle|. | 35 // |style| sets the link properties, see |StatusLabelStyle|. |
36 MessageType GetStatusLabels(ProfileSyncService* service, | 36 MessageType GetStatusLabels(ProfileSyncService* service, |
37 const SigninManager& signin, | 37 const SigninManagerBase& signin, |
38 StatusLabelStyle style, | 38 StatusLabelStyle style, |
39 string16* status_label, | 39 string16* status_label, |
40 string16* link_label); | 40 string16* link_label); |
41 | 41 |
42 // Same as above but for use specifically on the New Tab Page. | 42 // Same as above but for use specifically on the New Tab Page. |
43 // |status_label| may contain an HTML-formatted link. | 43 // |status_label| may contain an HTML-formatted link. |
44 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, | 44 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, |
45 const SigninManager& signin, | 45 const SigninManagerBase& signin, |
46 string16* status_label, | 46 string16* status_label, |
47 string16* link_label); | 47 string16* link_label); |
48 | 48 |
49 // Gets various labels for the sync global error based on the sync error state. | 49 // Gets various labels for the sync global error based on the sync error state. |
50 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be | 50 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be |
51 // NULL. | 51 // NULL. |
52 void GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, | 52 void GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, |
53 const SigninManager& signin, | 53 const SigninManagerBase& signin, |
54 string16* menu_item_label, | 54 string16* menu_item_label, |
55 string16* bubble_message, | 55 string16* bubble_message, |
56 string16* bubble_accept_label); | 56 string16* bubble_accept_label); |
57 | 57 |
58 MessageType GetStatus(ProfileSyncService* service, const SigninManager& signin); | 58 MessageType GetStatus(ProfileSyncService* service, |
| 59 const SigninManagerBase& signin); |
59 | 60 |
60 } // namespace sync_ui_util | 61 } // namespace sync_ui_util |
61 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 62 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
OLD | NEW |