| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 WITH_HTML // Label may contain an HTML-formatted link. | 37 WITH_HTML // Label may contain an HTML-formatted link. |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // TODO(akalin): audit the use of ProfileSyncService* service below, | 40 // TODO(akalin): audit the use of ProfileSyncService* service below, |
| 41 // and use const ProfileSyncService& service where possible. | 41 // and use const ProfileSyncService& service where possible. |
| 42 | 42 |
| 43 // Create status and link labels for the current status labels and link text | 43 // Create status and link labels for the current status labels and link text |
| 44 // by querying |service|. | 44 // by querying |service|. |
| 45 // |style| sets the link properties, see |StatusLabelStyle|. | 45 // |style| sets the link properties, see |StatusLabelStyle|. |
| 46 MessageType GetStatusLabels(ProfileSyncService* service, | 46 MessageType GetStatusLabels(ProfileSyncService* service, |
| 47 const SigninManager& signin, |
| 47 StatusLabelStyle style, | 48 StatusLabelStyle style, |
| 48 string16* status_label, | 49 string16* status_label, |
| 49 string16* link_label); | 50 string16* link_label); |
| 50 | 51 |
| 51 // Same as above but for use specifically on the New Tab Page. | 52 // Same as above but for use specifically on the New Tab Page. |
| 52 // |status_label| may contain an HTML-formatted link. | 53 // |status_label| may contain an HTML-formatted link. |
| 53 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, | 54 MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service, |
| 55 const SigninManager& signin, |
| 54 string16* status_label, | 56 string16* status_label, |
| 55 string16* link_label); | 57 string16* link_label); |
| 56 | 58 |
| 57 // Gets various labels for the sync global error based on the sync error state. | 59 // Gets various labels for the sync global error based on the sync error state. |
| 58 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be | 60 // |menu_item_label|, |bubble_message|, and |bubble_accept_label| must not be |
| 59 // NULL. | 61 // NULL. |
| 60 void GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, | 62 void GetStatusLabelsForSyncGlobalError(ProfileSyncService* service, |
| 63 const SigninManager& signin, |
| 61 string16* menu_item_label, | 64 string16* menu_item_label, |
| 62 string16* bubble_message, | 65 string16* bubble_message, |
| 63 string16* bubble_accept_label); | 66 string16* bubble_accept_label); |
| 64 | 67 |
| 65 MessageType GetStatus(ProfileSyncService* service); | 68 MessageType GetStatus(ProfileSyncService* service, const SigninManager& signin); |
| 66 | 69 |
| 67 // Returns a string with the synchronization status. | 70 // Returns a string with the synchronization status. |
| 68 string16 GetSyncMenuLabel(ProfileSyncService* service); | 71 string16 GetSyncMenuLabel(ProfileSyncService* service, |
| 72 const SigninManager& signin); |
| 69 | 73 |
| 70 void AddBoolSyncDetail(base::ListValue* details, | 74 void AddBoolSyncDetail(base::ListValue* details, |
| 71 const std::string& stat_name, | 75 const std::string& stat_name, |
| 72 bool stat_value); | 76 bool stat_value); |
| 73 | 77 |
| 74 // |service| can be NULL. | 78 // |service| can be NULL. |
| 75 void ConstructAboutInformation(ProfileSyncService* service, | 79 void ConstructAboutInformation(ProfileSyncService* service, |
| 76 DictionaryValue* strings); | 80 DictionaryValue* strings); |
| 77 | 81 |
| 78 void AddIntSyncDetail(base::ListValue* details, | 82 void AddIntSyncDetail(base::ListValue* details, |
| 79 const std::string& stat_name, | 83 const std::string& stat_name, |
| 80 int64 stat_value); | 84 int64 stat_value); |
| 81 | 85 |
| 82 void AddStringSyncDetails(ListValue* details, const std::string& stat_name, | 86 void AddStringSyncDetails(ListValue* details, const std::string& stat_name, |
| 83 const std::string& stat_value); | 87 const std::string& stat_value); |
| 84 | 88 |
| 85 // Returns a string describing the chrome version environment. Version format: | 89 // Returns a string describing the chrome version environment. Version format: |
| 86 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> | 90 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> |
| 87 // If version information is unavailable, returns "invalid." | 91 // If version information is unavailable, returns "invalid." |
| 88 // TODO(zea): this approximately matches MakeUserAgentForSyncApi in | 92 // TODO(zea): this approximately matches MakeUserAgentForSyncApi in |
| 89 // sync_backend_host.cc. Unify the two if possible. | 93 // sync_backend_host.cc. Unify the two if possible. |
| 90 std::string GetVersionString(); | 94 std::string GetVersionString(); |
| 91 | 95 |
| 92 } // namespace sync_ui_util | 96 } // namespace sync_ui_util |
| 93 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 97 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| OLD | NEW |