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 17 matching lines...) Expand all Loading... |
28 import extension_setting_specifics_pb2 | 28 import extension_setting_specifics_pb2 |
29 import extension_specifics_pb2 | 29 import extension_specifics_pb2 |
30 import history_delete_directive_specifics_pb2 | 30 import history_delete_directive_specifics_pb2 |
31 import nigori_specifics_pb2 | 31 import nigori_specifics_pb2 |
32 import password_specifics_pb2 | 32 import password_specifics_pb2 |
33 import preference_specifics_pb2 | 33 import preference_specifics_pb2 |
34 import search_engine_specifics_pb2 | 34 import search_engine_specifics_pb2 |
35 import session_specifics_pb2 | 35 import session_specifics_pb2 |
36 import sync_pb2 | 36 import sync_pb2 |
37 import sync_enums_pb2 | 37 import sync_enums_pb2 |
| 38 import synced_notification_specifics_pb2 |
38 import theme_specifics_pb2 | 39 import theme_specifics_pb2 |
39 import typed_url_specifics_pb2 | 40 import typed_url_specifics_pb2 |
40 | 41 |
41 # An enumeration of the various kinds of data that can be synced. | 42 # An enumeration of the various kinds of data that can be synced. |
42 # Over the wire, this enumeration is not used: a sync object's type is | 43 # Over the wire, this enumeration is not used: a sync object's type is |
43 # inferred by which EntitySpecifics field it has. But in the context | 44 # inferred by which EntitySpecifics field it has. But in the context |
44 # of a program, it is useful to have an enumeration. | 45 # of a program, it is useful to have an enumeration. |
45 ALL_TYPES = ( | 46 ALL_TYPES = ( |
46 TOP_LEVEL, # The type of the 'Google Chrome' folder. | 47 TOP_LEVEL, # The type of the 'Google Chrome' folder. |
47 APPS, | 48 APPS, |
48 APP_NOTIFICATION, | 49 APP_NOTIFICATION, |
49 APP_SETTINGS, | 50 APP_SETTINGS, |
50 AUTOFILL, | 51 AUTOFILL, |
51 AUTOFILL_PROFILE, | 52 AUTOFILL_PROFILE, |
52 BOOKMARK, | 53 BOOKMARK, |
53 DEVICE_INFO, | 54 DEVICE_INFO, |
54 EXPERIMENTS, | 55 EXPERIMENTS, |
55 EXTENSIONS, | 56 EXTENSIONS, |
56 HISTORY_DELETE_DIRECTIVE, | 57 HISTORY_DELETE_DIRECTIVE, |
57 NIGORI, | 58 NIGORI, |
58 PASSWORD, | 59 PASSWORD, |
59 PREFERENCE, | 60 PREFERENCE, |
60 SEARCH_ENGINE, | 61 SEARCH_ENGINE, |
61 SESSION, | 62 SESSION, |
| 63 SYNCED_NOTIFICATION, |
62 THEME, | 64 THEME, |
63 TYPED_URL, | 65 TYPED_URL, |
64 EXTENSION_SETTINGS) = range(19) | 66 EXTENSION_SETTINGS) = range(20) |
65 | 67 |
66 # An eumeration on the frequency at which the server should send errors | 68 # An eumeration on the frequency at which the server should send errors |
67 # to the client. This would be specified by the url that triggers the error. | 69 # to the client. This would be specified by the url that triggers the error. |
68 # Note: This enum should be kept in the same order as the enum in sync_test.h. | 70 # Note: This enum should be kept in the same order as the enum in sync_test.h. |
69 SYNC_ERROR_FREQUENCY = ( | 71 SYNC_ERROR_FREQUENCY = ( |
70 ERROR_FREQUENCY_NONE, | 72 ERROR_FREQUENCY_NONE, |
71 ERROR_FREQUENCY_ALWAYS, | 73 ERROR_FREQUENCY_ALWAYS, |
72 ERROR_FREQUENCY_TWO_THIRDS) = range(3) | 74 ERROR_FREQUENCY_TWO_THIRDS) = range(3) |
73 | 75 |
74 # Well-known server tag of the top level 'Google Chrome' folder. | 76 # Well-known server tag of the top level 'Google Chrome' folder. |
(...skipping 12 matching lines...) Expand all Loading... |
87 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], | 89 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], |
88 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], | 90 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], |
89 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], | 91 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], |
90 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], | 92 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], |
91 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], | 93 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], |
92 NIGORI: SYNC_TYPE_FIELDS['nigori'], | 94 NIGORI: SYNC_TYPE_FIELDS['nigori'], |
93 PASSWORD: SYNC_TYPE_FIELDS['password'], | 95 PASSWORD: SYNC_TYPE_FIELDS['password'], |
94 PREFERENCE: SYNC_TYPE_FIELDS['preference'], | 96 PREFERENCE: SYNC_TYPE_FIELDS['preference'], |
95 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], | 97 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], |
96 SESSION: SYNC_TYPE_FIELDS['session'], | 98 SESSION: SYNC_TYPE_FIELDS['session'], |
| 99 SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], |
97 THEME: SYNC_TYPE_FIELDS['theme'], | 100 THEME: SYNC_TYPE_FIELDS['theme'], |
98 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], | 101 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], |
99 } | 102 } |
100 | 103 |
101 # The parent ID used to indicate a top-level node. | 104 # The parent ID used to indicate a top-level node. |
102 ROOT_ID = '0' | 105 ROOT_ID = '0' |
103 | 106 |
104 # Unix time epoch in struct_time format. The tuple corresponds to UTC Wednesday | 107 # Unix time epoch in struct_time format. The tuple corresponds to UTC Wednesday |
105 # Jan 1 1970, 00:00:00, non-dst. | 108 # Jan 1 1970, 00:00:00, non-dst. |
106 UNIX_TIME_EPOCH = (1970, 1, 1, 0, 0, 0, 3, 1, 0) | 109 UNIX_TIME_EPOCH = (1970, 1, 1, 0, 0, 0, 3, 1, 0) |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 PermanentItem('google_chrome_history_delete_directives', | 465 PermanentItem('google_chrome_history_delete_directives', |
463 name='History Delete Directives', | 466 name='History Delete Directives', |
464 parent_tag=ROOT_ID, | 467 parent_tag=ROOT_ID, |
465 sync_type=HISTORY_DELETE_DIRECTIVE), | 468 sync_type=HISTORY_DELETE_DIRECTIVE), |
466 PermanentItem('google_chrome_nigori', name='Nigori', | 469 PermanentItem('google_chrome_nigori', name='Nigori', |
467 parent_tag=ROOT_ID, sync_type=NIGORI), | 470 parent_tag=ROOT_ID, sync_type=NIGORI), |
468 PermanentItem('google_chrome_passwords', name='Passwords', | 471 PermanentItem('google_chrome_passwords', name='Passwords', |
469 parent_tag=ROOT_ID, sync_type=PASSWORD), | 472 parent_tag=ROOT_ID, sync_type=PASSWORD), |
470 PermanentItem('google_chrome_preferences', name='Preferences', | 473 PermanentItem('google_chrome_preferences', name='Preferences', |
471 parent_tag=ROOT_ID, sync_type=PREFERENCE), | 474 parent_tag=ROOT_ID, sync_type=PREFERENCE), |
| 475 PermanentItem('google_chrome_preferences', name='Synced Notifications', |
| 476 parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION), |
472 PermanentItem('google_chrome_search_engines', name='Search Engines', | 477 PermanentItem('google_chrome_search_engines', name='Search Engines', |
473 parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), | 478 parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), |
474 PermanentItem('google_chrome_sessions', name='Sessions', | 479 PermanentItem('google_chrome_sessions', name='Sessions', |
475 parent_tag=ROOT_ID, sync_type=SESSION), | 480 parent_tag=ROOT_ID, sync_type=SESSION), |
476 PermanentItem('google_chrome_themes', name='Themes', | 481 PermanentItem('google_chrome_themes', name='Themes', |
477 parent_tag=ROOT_ID, sync_type=THEME), | 482 parent_tag=ROOT_ID, sync_type=THEME), |
478 PermanentItem('google_chrome_typed_urls', name='Typed URLs', | 483 PermanentItem('google_chrome_typed_urls', name='Typed URLs', |
479 parent_tag=ROOT_ID, sync_type=TYPED_URL), | 484 parent_tag=ROOT_ID, sync_type=TYPED_URL), |
480 ] | 485 ] |
481 | 486 |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 sending_nigori_node = False | 1362 sending_nigori_node = False |
1358 for entry in entries: | 1363 for entry in entries: |
1359 if entry.name == 'Nigori': | 1364 if entry.name == 'Nigori': |
1360 sending_nigori_node = True | 1365 sending_nigori_node = True |
1361 reply = update_response.entries.add() | 1366 reply = update_response.entries.add() |
1362 reply.CopyFrom(entry) | 1367 reply.CopyFrom(entry) |
1363 update_sieve.SaveProgress(new_timestamp, update_response) | 1368 update_sieve.SaveProgress(new_timestamp, update_response) |
1364 | 1369 |
1365 if update_request.need_encryption_key or sending_nigori_node: | 1370 if update_request.need_encryption_key or sending_nigori_node: |
1366 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 1371 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) |
OLD | NEW |