OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 13 matching lines...) Expand all Loading... |
24 import app_specifics_pb2 | 24 import app_specifics_pb2 |
25 import autofill_specifics_pb2 | 25 import autofill_specifics_pb2 |
26 import bookmark_specifics_pb2 | 26 import bookmark_specifics_pb2 |
27 import dictionary_specifics_pb2 | 27 import dictionary_specifics_pb2 |
28 import get_updates_caller_info_pb2 | 28 import get_updates_caller_info_pb2 |
29 import extension_setting_specifics_pb2 | 29 import extension_setting_specifics_pb2 |
30 import extension_specifics_pb2 | 30 import extension_specifics_pb2 |
31 import favicon_image_specifics_pb2 | 31 import favicon_image_specifics_pb2 |
32 import favicon_tracking_specifics_pb2 | 32 import favicon_tracking_specifics_pb2 |
33 import history_delete_directive_specifics_pb2 | 33 import history_delete_directive_specifics_pb2 |
| 34 import managed_user_setting_specifics_pb2 |
34 import nigori_specifics_pb2 | 35 import nigori_specifics_pb2 |
35 import password_specifics_pb2 | 36 import password_specifics_pb2 |
36 import preference_specifics_pb2 | 37 import preference_specifics_pb2 |
37 import priority_preference_specifics_pb2 | 38 import priority_preference_specifics_pb2 |
38 import search_engine_specifics_pb2 | 39 import search_engine_specifics_pb2 |
39 import session_specifics_pb2 | 40 import session_specifics_pb2 |
40 import sync_pb2 | 41 import sync_pb2 |
41 import sync_enums_pb2 | 42 import sync_enums_pb2 |
42 import synced_notification_specifics_pb2 | 43 import synced_notification_specifics_pb2 |
43 import theme_specifics_pb2 | 44 import theme_specifics_pb2 |
44 import typed_url_specifics_pb2 | 45 import typed_url_specifics_pb2 |
45 | 46 |
46 # An enumeration of the various kinds of data that can be synced. | 47 # An enumeration of the various kinds of data that can be synced. |
47 # Over the wire, this enumeration is not used: a sync object's type is | 48 # Over the wire, this enumeration is not used: a sync object's type is |
48 # inferred by which EntitySpecifics field it has. But in the context | 49 # inferred by which EntitySpecifics field it has. But in the context |
49 # of a program, it is useful to have an enumeration. | 50 # of a program, it is useful to have an enumeration. |
50 ALL_TYPES = ( | 51 ALL_TYPES = ( |
51 TOP_LEVEL, # The type of the 'Google Chrome' folder. | 52 TOP_LEVEL, # The type of the 'Google Chrome' folder. |
52 APPS, | 53 APPS, |
53 APP_NOTIFICATION, | 54 APP_NOTIFICATION, |
54 APP_SETTINGS, | 55 APP_SETTINGS, |
55 AUTOFILL, | 56 AUTOFILL, |
56 AUTOFILL_PROFILE, | 57 AUTOFILL_PROFILE, |
57 BOOKMARK, | 58 BOOKMARK, |
58 DEVICE_INFO, | 59 DEVICE_INFO, |
59 DICTIONARY, | 60 DICTIONARY, |
60 EXPERIMENTS, | 61 EXPERIMENTS, |
61 EXTENSIONS, | 62 EXTENSIONS, |
62 HISTORY_DELETE_DIRECTIVE, | 63 HISTORY_DELETE_DIRECTIVE, |
| 64 MANAGED_USER_SETTING, |
63 NIGORI, | 65 NIGORI, |
64 PASSWORD, | 66 PASSWORD, |
65 PREFERENCE, | 67 PREFERENCE, |
66 PRIORITY_PREFERENCE, | 68 PRIORITY_PREFERENCE, |
67 SEARCH_ENGINE, | 69 SEARCH_ENGINE, |
68 SESSION, | 70 SESSION, |
69 SYNCED_NOTIFICATION, | 71 SYNCED_NOTIFICATION, |
70 THEME, | 72 THEME, |
71 TYPED_URL, | 73 TYPED_URL, |
72 EXTENSION_SETTINGS, | 74 EXTENSION_SETTINGS, |
73 FAVICON_IMAGES, | 75 FAVICON_IMAGES, |
74 FAVICON_TRACKING) = range(24) | 76 FAVICON_TRACKING) = range(25) |
75 | 77 |
76 # An enumeration on the frequency at which the server should send errors | 78 # An enumeration on the frequency at which the server should send errors |
77 # to the client. This would be specified by the url that triggers the error. | 79 # to the client. This would be specified by the url that triggers the error. |
78 # Note: This enum should be kept in the same order as the enum in sync_test.h. | 80 # Note: This enum should be kept in the same order as the enum in sync_test.h. |
79 SYNC_ERROR_FREQUENCY = ( | 81 SYNC_ERROR_FREQUENCY = ( |
80 ERROR_FREQUENCY_NONE, | 82 ERROR_FREQUENCY_NONE, |
81 ERROR_FREQUENCY_ALWAYS, | 83 ERROR_FREQUENCY_ALWAYS, |
82 ERROR_FREQUENCY_TWO_THIRDS) = range(3) | 84 ERROR_FREQUENCY_TWO_THIRDS) = range(3) |
83 | 85 |
84 # Well-known server tag of the top level 'Google Chrome' folder. | 86 # Well-known server tag of the top level 'Google Chrome' folder. |
(...skipping 10 matching lines...) Expand all Loading... |
95 AUTOFILL_PROFILE: SYNC_TYPE_FIELDS['autofill_profile'], | 97 AUTOFILL_PROFILE: SYNC_TYPE_FIELDS['autofill_profile'], |
96 BOOKMARK: SYNC_TYPE_FIELDS['bookmark'], | 98 BOOKMARK: SYNC_TYPE_FIELDS['bookmark'], |
97 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], | 99 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], |
98 DICTIONARY: SYNC_TYPE_FIELDS['dictionary'], | 100 DICTIONARY: SYNC_TYPE_FIELDS['dictionary'], |
99 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], | 101 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], |
100 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], | 102 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], |
101 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], | 103 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], |
102 FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], | 104 FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], |
103 FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], | 105 FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], |
104 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], | 106 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], |
| 107 MANAGED_USER_SETTING: SYNC_TYPE_FIELDS['managed_user_setting'], |
105 NIGORI: SYNC_TYPE_FIELDS['nigori'], | 108 NIGORI: SYNC_TYPE_FIELDS['nigori'], |
106 PASSWORD: SYNC_TYPE_FIELDS['password'], | 109 PASSWORD: SYNC_TYPE_FIELDS['password'], |
107 PREFERENCE: SYNC_TYPE_FIELDS['preference'], | 110 PREFERENCE: SYNC_TYPE_FIELDS['preference'], |
108 PRIORITY_PREFERENCE: SYNC_TYPE_FIELDS['priority_preference'], | 111 PRIORITY_PREFERENCE: SYNC_TYPE_FIELDS['priority_preference'], |
109 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], | 112 SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], |
110 SESSION: SYNC_TYPE_FIELDS['session'], | 113 SESSION: SYNC_TYPE_FIELDS['session'], |
111 SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], | 114 SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], |
112 THEME: SYNC_TYPE_FIELDS['theme'], | 115 THEME: SYNC_TYPE_FIELDS['theme'], |
113 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], | 116 TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], |
114 } | 117 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 parent_tag=ROOT_ID, | 487 parent_tag=ROOT_ID, |
485 sync_type=HISTORY_DELETE_DIRECTIVE), | 488 sync_type=HISTORY_DELETE_DIRECTIVE), |
486 PermanentItem('google_chrome_favicon_images', | 489 PermanentItem('google_chrome_favicon_images', |
487 name='Favicon Images', | 490 name='Favicon Images', |
488 parent_tag=ROOT_ID, | 491 parent_tag=ROOT_ID, |
489 sync_type=FAVICON_IMAGES), | 492 sync_type=FAVICON_IMAGES), |
490 PermanentItem('google_chrome_favicon_tracking', | 493 PermanentItem('google_chrome_favicon_tracking', |
491 name='Favicon Tracking', | 494 name='Favicon Tracking', |
492 parent_tag=ROOT_ID, | 495 parent_tag=ROOT_ID, |
493 sync_type=FAVICON_TRACKING), | 496 sync_type=FAVICON_TRACKING), |
| 497 PermanentItem('google_chrome_managed_user_settings', |
| 498 name='Managed User Settings', |
| 499 parent_tag=ROOT_ID, sync_type=MANAGED_USER_SETTING), |
494 PermanentItem('google_chrome_nigori', name='Nigori', | 500 PermanentItem('google_chrome_nigori', name='Nigori', |
495 parent_tag=ROOT_ID, sync_type=NIGORI), | 501 parent_tag=ROOT_ID, sync_type=NIGORI), |
496 PermanentItem('google_chrome_passwords', name='Passwords', | 502 PermanentItem('google_chrome_passwords', name='Passwords', |
497 parent_tag=ROOT_ID, sync_type=PASSWORD), | 503 parent_tag=ROOT_ID, sync_type=PASSWORD), |
498 PermanentItem('google_chrome_preferences', name='Preferences', | 504 PermanentItem('google_chrome_preferences', name='Preferences', |
499 parent_tag=ROOT_ID, sync_type=PREFERENCE), | 505 parent_tag=ROOT_ID, sync_type=PREFERENCE), |
500 PermanentItem('google_chrome_priority_preferences', | 506 PermanentItem('google_chrome_priority_preferences', |
501 name='Priority Preferences', | 507 name='Priority Preferences', |
502 parent_tag=ROOT_ID, sync_type=PRIORITY_PREFERENCE), | 508 parent_tag=ROOT_ID, sync_type=PRIORITY_PREFERENCE), |
503 PermanentItem('google_chrome_synced_notifications', | 509 PermanentItem('google_chrome_synced_notifications', |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 sending_nigori_node = False | 1410 sending_nigori_node = False |
1405 for entry in entries: | 1411 for entry in entries: |
1406 if entry.name == 'Nigori': | 1412 if entry.name == 'Nigori': |
1407 sending_nigori_node = True | 1413 sending_nigori_node = True |
1408 reply = update_response.entries.add() | 1414 reply = update_response.entries.add() |
1409 reply.CopyFrom(entry) | 1415 reply.CopyFrom(entry) |
1410 update_sieve.SaveProgress(new_timestamp, update_response) | 1416 update_sieve.SaveProgress(new_timestamp, update_response) |
1411 | 1417 |
1412 if update_request.need_encryption_key or sending_nigori_node: | 1418 if update_request.need_encryption_key or sending_nigori_node: |
1413 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 1419 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) |
OLD | NEW |