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

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

Issue 2457483002: [MD Settings][Sync Settings] Updates sync status messages (Closed)
Patch Set: Addressed maxbogue's and dbeam's comments Created 4 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
« no previous file with comments | « chrome/browser/signin/signin_ui_util.cc ('k') | chrome/browser/sync/sync_ui_util.cc » ('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) 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; 12 class SigninManagerBase;
13 13
14 namespace browser_sync { 14 namespace browser_sync {
15 class ProfileSyncService; 15 class ProfileSyncService;
16 } // namespace browser_sync 16 } // namespace browser_sync
17 17
18 // Utility functions to gather current sync status information from the sync 18 // Utility functions to gather current sync status information from the sync
19 // service and constructs messages suitable for showing in UI. 19 // service and constructs messages suitable for showing in UI.
20 namespace sync_ui_util { 20 namespace sync_ui_util {
21 21
22 enum MessageType { 22 enum MessageType {
23 PRE_SYNCED, // User has not set up sync. 23 PRE_SYNCED, // User has not set up sync.
24 SYNCED, // We are synced and authenticated to a gmail account. 24 SYNCED, // We are synced and authenticated to a gmail account.
25 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. 25 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
26 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
27 // attention, but not as an error. 27 // attention, but not as an error.
28 }; 28 };
29 29
30 // The action associated with the sync status.
31 enum ActionType {
32 NO_ACTION, // No action to take.
33 REAUTHENTICATE, // User needs to reauthenticate.
34 UPGRADE_CLIENT, // User needs to upgrade the client.
35 ENTER_PASSPHRASE, // User needs to enter their passphrase.
36 };
37
30 enum StatusLabelStyle { 38 enum StatusLabelStyle {
31 PLAIN_TEXT, // Label will be plain-text only. 39 PLAIN_TEXT, // Label will be plain-text only.
32 WITH_HTML // Label may contain an HTML-formatted link. 40 WITH_HTML // Label may contain an HTML-formatted link.
33 }; 41 };
34 42
35 // Sync errors that should be exposed to the user through the avatar button. 43 // Sync errors that should be exposed to the user through the avatar button.
36 enum AvatarSyncErrorType { 44 enum AvatarSyncErrorType {
37 NO_SYNC_ERROR, // No sync error. 45 NO_SYNC_ERROR, // No sync error.
38 MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for managed users. 46 MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for managed users.
39 UNRECOVERABLE_ERROR, // Unrecoverable error for regular users. 47 UNRECOVERABLE_ERROR, // Unrecoverable error for regular users.
40 SUPERVISED_USER_AUTH_ERROR, // Auth token error for supervised users. 48 SUPERVISED_USER_AUTH_ERROR, // Auth token error for supervised users.
41 AUTH_ERROR, // Authentication error. 49 AUTH_ERROR, // Authentication error.
42 UPGRADE_CLIENT_ERROR, // Out-of-date client error. 50 UPGRADE_CLIENT_ERROR, // Out-of-date client error.
43 PASSPHRASE_ERROR // Sync passphrase error. 51 PASSPHRASE_ERROR // Sync passphrase error.
44 }; 52 };
45 53
46 // TODO(akalin): audit the use of ProfileSyncService* service below, 54 // TODO(akalin): audit the use of ProfileSyncService* service below,
47 // and use const ProfileSyncService& service where possible. 55 // and use const ProfileSyncService& service where possible.
48 56
49 // Create status and link labels for the current status labels and link text 57 // Create status and link labels for the current status labels and link text
50 // by querying |service|. 58 // by querying |service|.
51 // |style| sets the link properties, see |StatusLabelStyle|. 59 // |style| sets the link properties, see |StatusLabelStyle|.
52 MessageType GetStatusLabels(Profile* profile, 60 MessageType GetStatusLabels(Profile* profile,
53 browser_sync::ProfileSyncService* service, 61 browser_sync::ProfileSyncService* service,
54 const SigninManagerBase& signin, 62 const SigninManagerBase& signin,
55 StatusLabelStyle style, 63 StatusLabelStyle style,
56 base::string16* status_label, 64 base::string16* status_label,
57 base::string16* link_label); 65 base::string16* link_label,
66 ActionType* action_type);
58 67
59 // Same as above but for use specifically on the New Tab Page. 68 // Same as above but for use specifically on the New Tab Page.
60 // |status_label| may contain an HTML-formatted link. 69 // |status_label| may contain an HTML-formatted link.
61 MessageType GetStatusLabelsForNewTabPage( 70 MessageType GetStatusLabelsForNewTabPage(
62 Profile* profile, 71 Profile* profile,
63 browser_sync::ProfileSyncService* service, 72 browser_sync::ProfileSyncService* service,
64 const SigninManagerBase& signin, 73 const SigninManagerBase& signin,
65 base::string16* status_label, 74 base::string16* status_label,
66 base::string16* link_label); 75 base::string16* link_label);
67 76
(...skipping 13 matching lines...) Expand all
81 int* content_string_id, 90 int* content_string_id,
82 int* button_string_id); 91 int* button_string_id);
83 #endif 92 #endif
84 93
85 MessageType GetStatus(Profile* profile, 94 MessageType GetStatus(Profile* profile,
86 browser_sync::ProfileSyncService* service, 95 browser_sync::ProfileSyncService* service,
87 const SigninManagerBase& signin); 96 const SigninManagerBase& signin);
88 97
89 } // namespace sync_ui_util 98 } // namespace sync_ui_util
90 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ 99 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_ui_util.cc ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698