| 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 <string> | 8 #include "base/string16.h" |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 class ProfileSyncService; |
| 11 #include "base/values.h" | 11 class SigninManager; |
| 12 #include "chrome/browser/sync/profile_sync_service.h" | |
| 13 | |
| 14 class Browser; | |
| 15 class Profile; | |
| 16 | |
| 17 namespace base { | |
| 18 class ListValue; | |
| 19 class DictionaryValue; | |
| 20 } | |
| 21 | 12 |
| 22 // Utility functions to gather current sync status information from the sync | 13 // Utility functions to gather current sync status information from the sync |
| 23 // service and constructs messages suitable for showing in UI. | 14 // service and constructs messages suitable for showing in UI. |
| 24 namespace sync_ui_util { | 15 namespace sync_ui_util { |
| 25 | 16 |
| 26 enum MessageType { | 17 enum MessageType { |
| 27 PRE_SYNCED, // User has not set up sync. | 18 PRE_SYNCED, // User has not set up sync. |
| 28 SYNCED, // We are synced and authenticated to a gmail account. | 19 SYNCED, // We are synced and authenticated to a gmail account. |
| 29 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. | 20 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred. |
| 30 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 string16* menu_item_label, | 54 string16* menu_item_label, |
| 64 string16* bubble_message, | 55 string16* bubble_message, |
| 65 string16* bubble_accept_label); | 56 string16* bubble_accept_label); |
| 66 | 57 |
| 67 MessageType GetStatus(ProfileSyncService* service, const SigninManager& signin); | 58 MessageType GetStatus(ProfileSyncService* service, const SigninManager& signin); |
| 68 | 59 |
| 69 // Returns a string with the synchronization status. | 60 // Returns a string with the synchronization status. |
| 70 string16 GetSyncMenuLabel(ProfileSyncService* service, | 61 string16 GetSyncMenuLabel(ProfileSyncService* service, |
| 71 const SigninManager& signin); | 62 const SigninManager& signin); |
| 72 | 63 |
| 73 void AddBoolSyncDetail(base::ListValue* details, | |
| 74 const std::string& stat_name, | |
| 75 bool stat_value); | |
| 76 | |
| 77 // |service| can be NULL. | |
| 78 void ConstructAboutInformation(ProfileSyncService* service, | |
| 79 DictionaryValue* strings); | |
| 80 | |
| 81 void AddIntSyncDetail(base::ListValue* details, | |
| 82 const std::string& stat_name, | |
| 83 int64 stat_value); | |
| 84 | |
| 85 void AddStringSyncDetails(ListValue* details, const std::string& stat_name, | |
| 86 const std::string& stat_value); | |
| 87 | |
| 88 // Returns a string describing the chrome version environment. Version format: | |
| 89 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> | |
| 90 // If version information is unavailable, returns "invalid." | |
| 91 // TODO(zea): this approximately matches MakeUserAgentForSyncApi in | |
| 92 // sync_backend_host.cc. Unify the two if possible. | |
| 93 std::string GetVersionString(); | |
| 94 | |
| 95 } // namespace sync_ui_util | 64 } // namespace sync_ui_util |
| 96 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ | 65 #endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_ |
| OLD | NEW |