| 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 16 matching lines...) Expand all  Loading... | 
| 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 nigori_specifics_pb2 | 34 import nigori_specifics_pb2 | 
| 35 import password_specifics_pb2 | 35 import password_specifics_pb2 | 
| 36 import preference_specifics_pb2 | 36 import preference_specifics_pb2 | 
|  | 37 import priority_preference_specifics_pb2 | 
| 37 import search_engine_specifics_pb2 | 38 import search_engine_specifics_pb2 | 
| 38 import session_specifics_pb2 | 39 import session_specifics_pb2 | 
| 39 import sync_pb2 | 40 import sync_pb2 | 
| 40 import sync_enums_pb2 | 41 import sync_enums_pb2 | 
| 41 import synced_notification_specifics_pb2 | 42 import synced_notification_specifics_pb2 | 
| 42 import theme_specifics_pb2 | 43 import theme_specifics_pb2 | 
| 43 import typed_url_specifics_pb2 | 44 import typed_url_specifics_pb2 | 
| 44 | 45 | 
| 45 # An enumeration of the various kinds of data that can be synced. | 46 # An enumeration of the various kinds of data that can be synced. | 
| 46 # Over the wire, this enumeration is not used: a sync object's type is | 47 # Over the wire, this enumeration is not used: a sync object's type is | 
| 47 # inferred by which EntitySpecifics field it has.  But in the context | 48 # inferred by which EntitySpecifics field it has.  But in the context | 
| 48 # of a program, it is useful to have an enumeration. | 49 # of a program, it is useful to have an enumeration. | 
| 49 ALL_TYPES = ( | 50 ALL_TYPES = ( | 
| 50     TOP_LEVEL,  # The type of the 'Google Chrome' folder. | 51     TOP_LEVEL,  # The type of the 'Google Chrome' folder. | 
| 51     APPS, | 52     APPS, | 
| 52     APP_NOTIFICATION, | 53     APP_NOTIFICATION, | 
| 53     APP_SETTINGS, | 54     APP_SETTINGS, | 
| 54     AUTOFILL, | 55     AUTOFILL, | 
| 55     AUTOFILL_PROFILE, | 56     AUTOFILL_PROFILE, | 
| 56     BOOKMARK, | 57     BOOKMARK, | 
| 57     DEVICE_INFO, | 58     DEVICE_INFO, | 
| 58     DICTIONARY, | 59     DICTIONARY, | 
| 59     EXPERIMENTS, | 60     EXPERIMENTS, | 
| 60     EXTENSIONS, | 61     EXTENSIONS, | 
| 61     HISTORY_DELETE_DIRECTIVE, | 62     HISTORY_DELETE_DIRECTIVE, | 
| 62     NIGORI, | 63     NIGORI, | 
| 63     PASSWORD, | 64     PASSWORD, | 
| 64     PREFERENCE, | 65     PREFERENCE, | 
|  | 66     PRIORITY_PREFERENCE, | 
| 65     SEARCH_ENGINE, | 67     SEARCH_ENGINE, | 
| 66     SESSION, | 68     SESSION, | 
| 67     SYNCED_NOTIFICATION, | 69     SYNCED_NOTIFICATION, | 
| 68     THEME, | 70     THEME, | 
| 69     TYPED_URL, | 71     TYPED_URL, | 
| 70     EXTENSION_SETTINGS, | 72     EXTENSION_SETTINGS, | 
| 71     FAVICON_IMAGES, | 73     FAVICON_IMAGES, | 
| 72     FAVICON_TRACKING) = range(23) | 74     FAVICON_TRACKING) = range(24) | 
| 73 | 75 | 
| 74 # An enumeration on the frequency at which the server should send errors | 76 # An enumeration on the frequency at which the server should send errors | 
| 75 # to the client. This would be specified by the url that triggers the error. | 77 # to the client. This would be specified by the url that triggers the error. | 
| 76 # Note: This enum should be kept in the same order as the enum in sync_test.h. | 78 # Note: This enum should be kept in the same order as the enum in sync_test.h. | 
| 77 SYNC_ERROR_FREQUENCY = ( | 79 SYNC_ERROR_FREQUENCY = ( | 
| 78     ERROR_FREQUENCY_NONE, | 80     ERROR_FREQUENCY_NONE, | 
| 79     ERROR_FREQUENCY_ALWAYS, | 81     ERROR_FREQUENCY_ALWAYS, | 
| 80     ERROR_FREQUENCY_TWO_THIRDS) = range(3) | 82     ERROR_FREQUENCY_TWO_THIRDS) = range(3) | 
| 81 | 83 | 
| 82 # Well-known server tag of the top level 'Google Chrome' folder. | 84 # Well-known server tag of the top level 'Google Chrome' folder. | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 96     DICTIONARY: SYNC_TYPE_FIELDS['dictionary'], | 98     DICTIONARY: SYNC_TYPE_FIELDS['dictionary'], | 
| 97     EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], | 99     EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], | 
| 98     EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], | 100     EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], | 
| 99     EXTENSIONS: SYNC_TYPE_FIELDS['extension'], | 101     EXTENSIONS: SYNC_TYPE_FIELDS['extension'], | 
| 100     FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], | 102     FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], | 
| 101     FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], | 103     FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], | 
| 102     HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], | 104     HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], | 
| 103     NIGORI: SYNC_TYPE_FIELDS['nigori'], | 105     NIGORI: SYNC_TYPE_FIELDS['nigori'], | 
| 104     PASSWORD: SYNC_TYPE_FIELDS['password'], | 106     PASSWORD: SYNC_TYPE_FIELDS['password'], | 
| 105     PREFERENCE: SYNC_TYPE_FIELDS['preference'], | 107     PREFERENCE: SYNC_TYPE_FIELDS['preference'], | 
|  | 108     PRIORITY_PREFERENCE: SYNC_TYPE_FIELDS['priority_preference'], | 
| 106     SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], | 109     SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'], | 
| 107     SESSION: SYNC_TYPE_FIELDS['session'], | 110     SESSION: SYNC_TYPE_FIELDS['session'], | 
| 108     SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], | 111     SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"], | 
| 109     THEME: SYNC_TYPE_FIELDS['theme'], | 112     THEME: SYNC_TYPE_FIELDS['theme'], | 
| 110     TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], | 113     TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], | 
| 111     } | 114     } | 
| 112 | 115 | 
| 113 # The parent ID used to indicate a top-level node. | 116 # The parent ID used to indicate a top-level node. | 
| 114 ROOT_ID = '0' | 117 ROOT_ID = '0' | 
| 115 | 118 | 
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 487       PermanentItem('google_chrome_favicon_tracking', | 490       PermanentItem('google_chrome_favicon_tracking', | 
| 488                     name='Favicon Tracking', | 491                     name='Favicon Tracking', | 
| 489                     parent_tag=ROOT_ID, | 492                     parent_tag=ROOT_ID, | 
| 490                     sync_type=FAVICON_TRACKING), | 493                     sync_type=FAVICON_TRACKING), | 
| 491       PermanentItem('google_chrome_nigori', name='Nigori', | 494       PermanentItem('google_chrome_nigori', name='Nigori', | 
| 492                     parent_tag=ROOT_ID, sync_type=NIGORI), | 495                     parent_tag=ROOT_ID, sync_type=NIGORI), | 
| 493       PermanentItem('google_chrome_passwords', name='Passwords', | 496       PermanentItem('google_chrome_passwords', name='Passwords', | 
| 494                     parent_tag=ROOT_ID, sync_type=PASSWORD), | 497                     parent_tag=ROOT_ID, sync_type=PASSWORD), | 
| 495       PermanentItem('google_chrome_preferences', name='Preferences', | 498       PermanentItem('google_chrome_preferences', name='Preferences', | 
| 496                     parent_tag=ROOT_ID, sync_type=PREFERENCE), | 499                     parent_tag=ROOT_ID, sync_type=PREFERENCE), | 
|  | 500       PermanentItem('google_chrome_priority_preferences', | 
|  | 501                     name='Priority Preferences', | 
|  | 502                     parent_tag=ROOT_ID, sync_type=PRIORITY_PREFERENCE), | 
| 497       PermanentItem('google_chrome_synced_notifications', | 503       PermanentItem('google_chrome_synced_notifications', | 
| 498                     name='Synced Notifications', | 504                     name='Synced Notifications', | 
| 499                     parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION), | 505                     parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION), | 
| 500       PermanentItem('google_chrome_search_engines', name='Search Engines', | 506       PermanentItem('google_chrome_search_engines', name='Search Engines', | 
| 501                     parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), | 507                     parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), | 
| 502       PermanentItem('google_chrome_sessions', name='Sessions', | 508       PermanentItem('google_chrome_sessions', name='Sessions', | 
| 503                     parent_tag=ROOT_ID, sync_type=SESSION), | 509                     parent_tag=ROOT_ID, sync_type=SESSION), | 
| 504       PermanentItem('google_chrome_themes', name='Themes', | 510       PermanentItem('google_chrome_themes', name='Themes', | 
| 505                     parent_tag=ROOT_ID, sync_type=THEME), | 511                     parent_tag=ROOT_ID, sync_type=THEME), | 
| 506       PermanentItem('google_chrome_typed_urls', name='Typed URLs', | 512       PermanentItem('google_chrome_typed_urls', name='Typed URLs', | 
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1394     sending_nigori_node = False | 1400     sending_nigori_node = False | 
| 1395     for entry in entries: | 1401     for entry in entries: | 
| 1396       if entry.name == 'Nigori': | 1402       if entry.name == 'Nigori': | 
| 1397         sending_nigori_node = True | 1403         sending_nigori_node = True | 
| 1398       reply = update_response.entries.add() | 1404       reply = update_response.entries.add() | 
| 1399       reply.CopyFrom(entry) | 1405       reply.CopyFrom(entry) | 
| 1400     update_sieve.SaveProgress(new_timestamp, update_response) | 1406     update_sieve.SaveProgress(new_timestamp, update_response) | 
| 1401 | 1407 | 
| 1402     if update_request.need_encryption_key or sending_nigori_node: | 1408     if update_request.need_encryption_key or sending_nigori_node: | 
| 1403       update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 1409       update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 
| OLD | NEW | 
|---|