Chromium Code Reviews| 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 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 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. | 30 // The action associated with the sync status. |
| 31 enum ActionType { | 31 enum ActionType { |
| 32 NO_ACTION, // No action to take. | 32 NO_ACTION, // No action to take. |
| 33 REAUTHENTICATE, // User needs to reauthenticate. | 33 REAUTHENTICATE, // User needs to reauthenticate. |
| 34 SIGNOUT_AND_SIGNIN, // User needs to sign out and sign in. | 34 SIGNOUT_AND_SIGNIN, // User needs to sign out and sign in. |
| 35 UPGRADE_CLIENT, // User needs to upgrade the client. | 35 UPGRADE_CLIENT, // User needs to upgrade the client. |
| 36 ENTER_PASSPHRASE, // User needs to enter their passphrase. | 36 ENTER_PASSPHRASE, // User needs to enter their passphrase. |
| 37 CONFIRM_SYNC_SETTINGS, // User needs to finish sync setup. | |
|
skym
2017/06/01 19:48:44
finish? not confirm?
Patrick Noland
2017/06/07 19:07:23
Done.
| |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 enum StatusLabelStyle { | 40 enum StatusLabelStyle { |
| 40 PLAIN_TEXT, // Label will be plain-text only. | 41 PLAIN_TEXT, // Label will be plain-text only. |
| 41 WITH_HTML // Label may contain an HTML-formatted link. | 42 WITH_HTML // Label may contain an HTML-formatted link. |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // Sync errors that should be exposed to the user through the avatar button. | 45 // Sync errors that should be exposed to the user through the avatar button. |
| 45 enum AvatarSyncErrorType { | 46 enum AvatarSyncErrorType { |
| 46 NO_SYNC_ERROR, // No sync error. | 47 NO_SYNC_ERROR, // No sync error. |
| 47 MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for managed users. | 48 MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for managed users. |
| 48 UNRECOVERABLE_ERROR, // Unrecoverable error for regular users. | 49 UNRECOVERABLE_ERROR, // Unrecoverable error for regular users. |
| 49 SUPERVISED_USER_AUTH_ERROR, // Auth token error for supervised users. | 50 SUPERVISED_USER_AUTH_ERROR, // Auth token error for supervised users. |
| 50 AUTH_ERROR, // Authentication error. | 51 AUTH_ERROR, // Authentication error. |
| 51 UPGRADE_CLIENT_ERROR, // Out-of-date client error. | 52 UPGRADE_CLIENT_ERROR, // Out-of-date client error. |
| 52 PASSPHRASE_ERROR // Sync passphrase error. | 53 PASSPHRASE_ERROR, // Sync passphrase error. |
| 54 SETTINGS_UNCONFIRMED_ERROR, // Sync settings dialog not confirmed yet. | |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 // TODO(akalin): audit the use of ProfileSyncService* service below, | 57 // TODO(akalin): audit the use of ProfileSyncService* service below, |
| 56 // and use const ProfileSyncService& service where possible. | 58 // and use const ProfileSyncService& service where possible. |
| 57 | 59 |
| 58 // Create status and link labels for the current status labels and link text | 60 // Create status and link labels for the current status labels and link text |
| 59 // by querying |service|. | 61 // by querying |service|. |
| 60 // |style| sets the link properties, see |StatusLabelStyle|. | 62 // |style| sets the link properties, see |StatusLabelStyle|. |
| 61 MessageType GetStatusLabels(Profile* profile, | 63 MessageType GetStatusLabels(Profile* profile, |
| 62 browser_sync::ProfileSyncService* service, | 64 browser_sync::ProfileSyncService* service, |
| 63 const SigninManagerBase& signin, | 65 const SigninManagerBase& signin, |
| 64 StatusLabelStyle style, | 66 StatusLabelStyle style, |
| 65 base::string16* status_label, | 67 base::string16* status_label, |
| 66 base::string16* link_label, | 68 base::string16* link_label, |
| 67 ActionType* action_type); | 69 ActionType* action_type); |
| 68 | 70 |
| 69 // Same as above but for use specifically on the New Tab Page. | 71 // Same as above but for use specifically on the New Tab Page. |
| 70 // |status_label| may contain an HTML-formatted link. | 72 // |status_label| may contain an HTML-formatted link. |
| 71 MessageType GetStatusLabelsForNewTabPage( | 73 MessageType GetStatusLabelsForNewTabPage( |
| 72 Profile* profile, | 74 Profile* profile, |
| 73 browser_sync::ProfileSyncService* service, | 75 browser_sync::ProfileSyncService* service, |
| 74 const SigninManagerBase& signin, | 76 const SigninManagerBase& signin, |
| 75 base::string16* status_label, | 77 base::string16* status_label, |
| 76 base::string16* link_label); | 78 base::string16* link_label); |
| 77 | 79 |
| 78 #if !defined(OS_CHROMEOS) | 80 #if !defined(OS_CHROMEOS) |
| 79 // Gets the error message and button label for the sync errors that should be | 81 // Gets the error message and button label for the sync errors that should be |
| 80 // exposed to the user through the titlebar avatar button. | 82 // exposed to the user through the titlebar avatar button. |
| 81 AvatarSyncErrorType GetMessagesForAvatarSyncError(Profile* profile, | 83 AvatarSyncErrorType GetMessagesForAvatarSyncError( |
| 82 int* content_string_id, | 84 Profile* profile, |
| 83 int* button_string_id); | 85 const SigninManagerBase& signin, |
| 86 int* content_string_id, | |
| 87 int* button_string_id); | |
| 84 #endif | 88 #endif |
| 85 | 89 |
| 86 MessageType GetStatus(Profile* profile, | 90 MessageType GetStatus(Profile* profile, |
| 87 browser_sync::ProfileSyncService* service, | 91 browser_sync::ProfileSyncService* service, |
| 88 const SigninManagerBase& signin); | 92 const SigninManagerBase& signin); |
| 89 | 93 |
| 90 } // namespace sync_ui_util | 94 } // namespace sync_ui_util |
| 91 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 95 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| OLD | NEW |