| 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 """An implementation of the server side of the Chromium sync protocol. | 5 """An implementation of the server side of the Chromium sync protocol. |
| 6 | 6 |
| 7 The details of the protocol are described mostly by comments in the protocol | 7 The details of the protocol are described mostly by comments in the protocol |
| 8 buffer definition at chrome/browser/sync/protocol/sync.proto. | 8 buffer definition at chrome/browser/sync/protocol/sync.proto. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 EXTENSIONS, | 56 EXTENSIONS, |
| 57 HISTORY_DELETE_DIRECTIVE, | 57 HISTORY_DELETE_DIRECTIVE, |
| 58 NIGORI, | 58 NIGORI, |
| 59 PASSWORD, | 59 PASSWORD, |
| 60 PREFERENCE, | 60 PREFERENCE, |
| 61 SEARCH_ENGINE, | 61 SEARCH_ENGINE, |
| 62 SESSION, | 62 SESSION, |
| 63 SYNCED_NOTIFICATION, | 63 SYNCED_NOTIFICATION, |
| 64 THEME, | 64 THEME, |
| 65 TYPED_URL, | 65 TYPED_URL, |
| 66 EXTENSION_SETTINGS) = range(20) | 66 EXTENSION_SETTINGS, |
| 67 TAB,) = range(21) |
| 67 | 68 |
| 68 # An eumeration on the frequency at which the server should send errors | 69 # An eumeration on the frequency at which the server should send errors |
| 69 # to the client. This would be specified by the url that triggers the error. | 70 # to the client. This would be specified by the url that triggers the error. |
| 70 # Note: This enum should be kept in the same order as the enum in sync_test.h. | 71 # Note: This enum should be kept in the same order as the enum in sync_test.h. |
| 71 SYNC_ERROR_FREQUENCY = ( | 72 SYNC_ERROR_FREQUENCY = ( |
| 72 ERROR_FREQUENCY_NONE, | 73 ERROR_FREQUENCY_NONE, |
| 73 ERROR_FREQUENCY_ALWAYS, | 74 ERROR_FREQUENCY_ALWAYS, |
| 74 ERROR_FREQUENCY_TWO_THIRDS) = range(3) | 75 ERROR_FREQUENCY_TWO_THIRDS) = range(3) |
| 75 | 76 |
| 76 # Well-known server tag of the top level 'Google Chrome' folder. | 77 # Well-known server tag of the top level 'Google Chrome' folder. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], | 93 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], |
| 93 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], | 94 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], |
| 94 NIGORI: SYNC_TYPE_FIELDS['nigori'], | 95 NIGORI: SYNC_TYPE_FIELDS['nigori'], |
| 95 PASSWORD: SYNC_TYPE_FIELDS['password'], | 96 PASSWORD: SYNC_TYPE_FIELDS['password'], |
| 96 PREFERENCE: SYNC_TYPE_FIELDS['preference'], | 97 PREFERENCE: SYNC_TYPE_FIELDS['preference'], |
| 97 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], | 98 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], |
| 98 SESSION: SYNC_TYPE_FIELDS['session'], | 99 SESSION: SYNC_TYPE_FIELDS['session'], |
| 99 SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], | 100 SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], |
| 100 THEME: SYNC_TYPE_FIELDS['theme'], | 101 THEME: SYNC_TYPE_FIELDS['theme'], |
| 101 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], | 102 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], |
| 103 TAB: SYNC_TYPE_FIELDS['tab'], |
| 102 } | 104 } |
| 103 | 105 |
| 104 # The parent ID used to indicate a top-level node. | 106 # The parent ID used to indicate a top-level node. |
| 105 ROOT_ID = '0' | 107 ROOT_ID = '0' |
| 106 | 108 |
| 107 # Unix time epoch in struct_time format. The tuple corresponds to UTC Wednesday | 109 # Unix time epoch in struct_time format. The tuple corresponds to UTC Wednesday |
| 108 # Jan 1 1970, 00:00:00, non-dst. | 110 # Jan 1 1970, 00:00:00, non-dst. |
| 109 UNIX_TIME_EPOCH = (1970, 1, 1, 0, 0, 0, 3, 1, 0) | 111 UNIX_TIME_EPOCH = (1970, 1, 1, 0, 0, 0, 3, 1, 0) |
| 110 | 112 |
| 111 # The number of characters in the server-generated encryption key. | 113 # The number of characters in the server-generated encryption key. |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 sending_nigori_node = False | 1364 sending_nigori_node = False |
| 1363 for entry in entries: | 1365 for entry in entries: |
| 1364 if entry.name == 'Nigori': | 1366 if entry.name == 'Nigori': |
| 1365 sending_nigori_node = True | 1367 sending_nigori_node = True |
| 1366 reply = update_response.entries.add() | 1368 reply = update_response.entries.add() |
| 1367 reply.CopyFrom(entry) | 1369 reply.CopyFrom(entry) |
| 1368 update_sieve.SaveProgress(new_timestamp, update_response) | 1370 update_sieve.SaveProgress(new_timestamp, update_response) |
| 1369 | 1371 |
| 1370 if update_request.need_encryption_key or sending_nigori_node: | 1372 if update_request.need_encryption_key or sending_nigori_node: |
| 1371 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 1373 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) |
| OLD | NEW |