OLD | NEW |
| (Empty) |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_ | |
5 #define SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_ | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/values.h" | |
10 #include "sync/base/sync_export.h" | |
11 #include "sync/internal_api/public/base/model_type.h" | |
12 | |
13 namespace syncer { | |
14 | |
15 enum SyncProtocolErrorType { | |
16 // Success case. | |
17 SYNC_SUCCESS, | |
18 | |
19 // Birthday does not match that of the server. | |
20 NOT_MY_BIRTHDAY, | |
21 | |
22 // Server is busy. Try later. | |
23 THROTTLED, | |
24 | |
25 // Clear user data is being currently executed by the server. | |
26 CLEAR_PENDING, | |
27 | |
28 // Server cannot service the request now. | |
29 TRANSIENT_ERROR, | |
30 | |
31 // Indicates the datatypes have been migrated and the client should resync | |
32 // them to get the latest progress markers. | |
33 MIGRATION_DONE, | |
34 | |
35 // Invalid Credential. | |
36 INVALID_CREDENTIAL, | |
37 | |
38 // An administrator disabled sync for this domain. | |
39 DISABLED_BY_ADMIN, | |
40 | |
41 // Some of servers are busy. Try later with busy servers. | |
42 PARTIAL_FAILURE, | |
43 | |
44 // Returned when server detects that this client's data is obsolete. Client | |
45 // should reset local data and restart syncing. | |
46 CLIENT_DATA_OBSOLETE, | |
47 | |
48 // The default value. | |
49 UNKNOWN_ERROR | |
50 }; | |
51 | |
52 enum ClientAction { | |
53 // Upgrade the client to latest version. | |
54 UPGRADE_CLIENT, | |
55 | |
56 // Clear user data and setup sync again. | |
57 CLEAR_USER_DATA_AND_RESYNC, | |
58 | |
59 // Set the bit on the account to enable sync. | |
60 ENABLE_SYNC_ON_ACCOUNT, | |
61 | |
62 // Stop sync and restart sync. | |
63 STOP_AND_RESTART_SYNC, | |
64 | |
65 // Wipe this client of any sync data. | |
66 DISABLE_SYNC_ON_CLIENT, | |
67 | |
68 // Account is disabled by admin. Stop sync, clear prefs and show message on | |
69 // settings page that account is disabled. | |
70 STOP_SYNC_FOR_DISABLED_ACCOUNT, | |
71 | |
72 // Generated in response to CLIENT_DATA_OBSOLETE error. ProfileSyncService | |
73 // should stop sync engine, delete directory and restart sync engine. | |
74 RESET_LOCAL_SYNC_DATA, | |
75 | |
76 // The default. No action. | |
77 UNKNOWN_ACTION | |
78 }; | |
79 | |
80 struct SYNC_EXPORT SyncProtocolError { | |
81 SyncProtocolErrorType error_type; | |
82 std::string error_description; | |
83 std::string url; | |
84 ClientAction action; | |
85 ModelTypeSet error_data_types; | |
86 SyncProtocolError(); | |
87 SyncProtocolError(const SyncProtocolError& other); | |
88 ~SyncProtocolError(); | |
89 base::DictionaryValue* ToValue() const; | |
90 }; | |
91 | |
92 SYNC_EXPORT const char* GetSyncErrorTypeString(SyncProtocolErrorType type); | |
93 SYNC_EXPORT const char* GetClientActionString(ClientAction action); | |
94 } // namespace syncer | |
95 #endif // SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_ | |
96 | |
OLD | NEW |