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

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

Issue 2179283002: Refactored signin/sync error controllers for the avatar button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored logic for classifying errors Created 4 years, 4 months 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
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
(...skipping 11 matching lines...) Expand all
22 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. 22 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 23 SYNC_PROMO, // A situation has occurred which should be brought to the user's
24 // attention, but not as an error. 24 // attention, but not as an error.
25 }; 25 };
26 26
27 enum StatusLabelStyle { 27 enum StatusLabelStyle {
28 PLAIN_TEXT, // Label will be plain-text only. 28 PLAIN_TEXT, // Label will be plain-text only.
29 WITH_HTML // Label may contain an HTML-formatted link. 29 WITH_HTML // Label may contain an HTML-formatted link.
30 }; 30 };
31 31
32 // Sync errors that should be exposed to the user through the avatar button.
33 enum SyncErrorType {
34 NO_ERROR, // No sync error.
35 MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for managed users.
36 UNRECOVERABLE_ERROR, // Unrecoverable error for regular users.
37 AUTH_ERROR, // Authentication error.
38 UPGRADE_CLIENT_ERROR, // Out-of-date client error.
39 PASSPHRASE_ERROR // Sync passphrase error.
40 };
Roger Tawa OOO till Jul 10th 2016/07/27 15:38:02 Maybe make the name of this enum type mention "ava
Jane 2016/07/27 15:51:02 Done.
41
32 // TODO(akalin): audit the use of ProfileSyncService* service below, 42 // TODO(akalin): audit the use of ProfileSyncService* service below,
33 // and use const ProfileSyncService& service where possible. 43 // and use const ProfileSyncService& service where possible.
34 44
35 // Create status and link labels for the current status labels and link text 45 // Create status and link labels for the current status labels and link text
36 // by querying |service|. 46 // by querying |service|.
37 // |style| sets the link properties, see |StatusLabelStyle|. 47 // |style| sets the link properties, see |StatusLabelStyle|.
38 MessageType GetStatusLabels(Profile* profile, 48 MessageType GetStatusLabels(Profile* profile,
39 ProfileSyncService* service, 49 ProfileSyncService* service,
40 const SigninManagerBase& signin, 50 const SigninManagerBase& signin,
41 StatusLabelStyle style, 51 StatusLabelStyle style,
42 base::string16* status_label, 52 base::string16* status_label,
43 base::string16* link_label); 53 base::string16* link_label);
44 54
45 // Same as above but for use specifically on the New Tab Page. 55 // Same as above but for use specifically on the New Tab Page.
46 // |status_label| may contain an HTML-formatted link. 56 // |status_label| may contain an HTML-formatted link.
47 MessageType GetStatusLabelsForNewTabPage(Profile* profile, 57 MessageType GetStatusLabelsForNewTabPage(Profile* profile,
48 ProfileSyncService* service, 58 ProfileSyncService* service,
49 const SigninManagerBase& signin, 59 const SigninManagerBase& signin,
50 base::string16* status_label, 60 base::string16* status_label,
51 base::string16* link_label); 61 base::string16* link_label);
52 62
63 #if !defined(OS_CHROMEOS)
53 // Gets various labels for the sync global error based on the sync error state. 64 // Gets various labels for the sync global error based on the sync error state.
54 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be 65 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be
55 // NULL. Note that we don't use SyncGlobalError on Chrome OS. 66 // NULL. Note that we don't use SyncGlobalError on Chrome OS.
56 #if !defined(OS_CHROMEOS)
57 void GetStatusLabelsForSyncGlobalError(const ProfileSyncService* service, 67 void GetStatusLabelsForSyncGlobalError(const ProfileSyncService* service,
58 base::string16* menu_item_label, 68 base::string16* menu_item_label,
59 base::string16* bubble_message, 69 base::string16* bubble_message,
60 base::string16* bubble_accept_label); 70 base::string16* bubble_accept_label);
71
72 // Gets the error message and button label for the sync errors that should be
73 // exposed to the user through the titlebar avatar button.
74 SyncErrorType GetMessagesForAvatarSyncError(Profile* profile,
75 int* content_string_id,
76 int* button_string_id);
61 #endif 77 #endif
62 78
63 MessageType GetStatus(Profile* profile, 79 MessageType GetStatus(Profile* profile,
64 ProfileSyncService* service, 80 ProfileSyncService* service,
65 const SigninManagerBase& signin); 81 const SigninManagerBase& signin);
66 82
67 } // namespace sync_ui_util 83 } // namespace sync_ui_util
68 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ 84 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/avatar_sync_error_controller.cc ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698