Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: net/tools/testserver/chromiumsync.py

Issue 8375047: Separate the syncing of extension settings and app settings into separate data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """An implementation of the server side of the Chromium sync protocol. 6 """An implementation of the server side of the Chromium sync protocol.
7 7
8 The details of the protocol are described mostly by comments in the protocol 8 The details of the protocol are described mostly by comments in the protocol
9 buffer definition at chrome/browser/sync/protocol/sync.proto. 9 buffer definition at chrome/browser/sync/protocol/sync.proto.
10 """ 10 """
11 11
12 import cgi 12 import cgi
13 import copy 13 import copy
14 import operator 14 import operator
15 import pickle 15 import pickle
16 import random 16 import random
17 import sys 17 import sys
18 import threading 18 import threading
19 import urlparse 19 import urlparse
20 20
21 import app_notification_specifics_pb2
22 import app_setting_specifics_pb2
21 import app_specifics_pb2 23 import app_specifics_pb2
22 import app_notification_specifics_pb2
23 import autofill_specifics_pb2 24 import autofill_specifics_pb2
24 import bookmark_specifics_pb2 25 import bookmark_specifics_pb2
25 import extension_setting_specifics_pb2 26 import extension_setting_specifics_pb2
26 import extension_specifics_pb2 27 import extension_specifics_pb2
27 import nigori_specifics_pb2 28 import nigori_specifics_pb2
28 import password_specifics_pb2 29 import password_specifics_pb2
29 import preference_specifics_pb2 30 import preference_specifics_pb2
30 import search_engine_specifics_pb2 31 import search_engine_specifics_pb2
31 import session_specifics_pb2 32 import session_specifics_pb2
32 import sync_pb2 33 import sync_pb2
33 import theme_specifics_pb2 34 import theme_specifics_pb2
34 import typed_url_specifics_pb2 35 import typed_url_specifics_pb2
35 36
36 # An enumeration of the various kinds of data that can be synced. 37 # An enumeration of the various kinds of data that can be synced.
37 # Over the wire, this enumeration is not used: a sync object's type is 38 # Over the wire, this enumeration is not used: a sync object's type is
38 # inferred by which EntitySpecifics extension it has. But in the context 39 # inferred by which EntitySpecifics extension it has. But in the context
39 # of a program, it is useful to have an enumeration. 40 # of a program, it is useful to have an enumeration.
40 ALL_TYPES = ( 41 ALL_TYPES = (
41 TOP_LEVEL, # The type of the 'Google Chrome' folder. 42 TOP_LEVEL, # The type of the 'Google Chrome' folder.
42 APPS, 43 APPS,
43 APP_NOTIFICATION, 44 APP_NOTIFICATION,
45 APP_SETTINGS,
44 AUTOFILL, 46 AUTOFILL,
45 AUTOFILL_PROFILE, 47 AUTOFILL_PROFILE,
46 BOOKMARK, 48 BOOKMARK,
47 EXTENSIONS, 49 EXTENSIONS,
48 NIGORI, 50 NIGORI,
49 PASSWORD, 51 PASSWORD,
50 PREFERENCE, 52 PREFERENCE,
51 SEARCH_ENGINE, 53 SEARCH_ENGINE,
52 SESSION, 54 SESSION,
53 THEME, 55 THEME,
54 TYPED_URL, 56 TYPED_URL,
55 EXTENSION_SETTINGS) = range(15) 57 EXTENSION_SETTINGS) = range(16)
56 58
57 # Well-known server tag of the top level 'Google Chrome' folder. 59 # Well-known server tag of the top level 'Google Chrome' folder.
58 TOP_LEVEL_FOLDER_TAG = 'google_chrome' 60 TOP_LEVEL_FOLDER_TAG = 'google_chrome'
59 61
60 # Given a sync type from ALL_TYPES, find the extension token corresponding 62 # Given a sync type from ALL_TYPES, find the extension token corresponding
61 # to that datatype. Note that TOP_LEVEL has no such token. 63 # to that datatype. Note that TOP_LEVEL has no such token.
62 SYNC_TYPE_TO_EXTENSION = { 64 SYNC_TYPE_TO_EXTENSION = {
65 APP_NOTIFICATION: app_notification_specifics_pb2.app_notification,
66 APP_SETTINGS: app_setting_specifics_pb2.app_setting,
63 APPS: app_specifics_pb2.app, 67 APPS: app_specifics_pb2.app,
64 APP_NOTIFICATION: app_notification_specifics_pb2.app_notification,
65 AUTOFILL: autofill_specifics_pb2.autofill, 68 AUTOFILL: autofill_specifics_pb2.autofill,
66 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile, 69 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile,
67 BOOKMARK: bookmark_specifics_pb2.bookmark, 70 BOOKMARK: bookmark_specifics_pb2.bookmark,
68 EXTENSION_SETTINGS: extension_setting_specifics_pb2.extension_setting, 71 EXTENSION_SETTINGS: extension_setting_specifics_pb2.extension_setting,
69 EXTENSIONS: extension_specifics_pb2.extension, 72 EXTENSIONS: extension_specifics_pb2.extension,
70 NIGORI: nigori_specifics_pb2.nigori, 73 NIGORI: nigori_specifics_pb2.nigori,
71 PASSWORD: password_specifics_pb2.password, 74 PASSWORD: password_specifics_pb2.password,
72 PREFERENCE: preference_specifics_pb2.preference, 75 PREFERENCE: preference_specifics_pb2.preference,
73 SEARCH_ENGINE: search_engine_specifics_pb2.search_engine, 76 SEARCH_ENGINE: search_engine_specifics_pb2.search_engine,
74 SESSION: session_specifics_pb2.session, 77 SESSION: session_specifics_pb2.session,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 PermanentItem('bookmark_bar', name='Bookmark Bar', 390 PermanentItem('bookmark_bar', name='Bookmark Bar',
388 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 391 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
389 PermanentItem('other_bookmarks', name='Other Bookmarks', 392 PermanentItem('other_bookmarks', name='Other Bookmarks',
390 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 393 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
391 PermanentItem('google_chrome_preferences', name='Preferences', 394 PermanentItem('google_chrome_preferences', name='Preferences',
392 parent_tag='google_chrome', sync_type=PREFERENCE), 395 parent_tag='google_chrome', sync_type=PREFERENCE),
393 PermanentItem('google_chrome_autofill', name='Autofill', 396 PermanentItem('google_chrome_autofill', name='Autofill',
394 parent_tag='google_chrome', sync_type=AUTOFILL), 397 parent_tag='google_chrome', sync_type=AUTOFILL),
395 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', 398 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles',
396 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE), 399 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE),
400 PermanentItem('google_chrome_app_settings',
401 name='App Settings',
402 parent_tag='google_chrome', sync_type=APP_SETTINGS),
397 PermanentItem('google_chrome_extension_settings', 403 PermanentItem('google_chrome_extension_settings',
398 name='Extension Settings', 404 name='Extension Settings',
399 parent_tag='google_chrome', sync_type=EXTENSION_SETTINGS), 405 parent_tag='google_chrome', sync_type=EXTENSION_SETTINGS),
400 PermanentItem('google_chrome_extensions', name='Extensions', 406 PermanentItem('google_chrome_extensions', name='Extensions',
401 parent_tag='google_chrome', sync_type=EXTENSIONS), 407 parent_tag='google_chrome', sync_type=EXTENSIONS),
402 PermanentItem('google_chrome_passwords', name='Passwords', 408 PermanentItem('google_chrome_passwords', name='Passwords',
403 parent_tag='google_chrome', sync_type=PASSWORD), 409 parent_tag='google_chrome', sync_type=PASSWORD),
404 PermanentItem('google_chrome_search_engines', name='Search Engines', 410 PermanentItem('google_chrome_search_engines', name='Search Engines',
405 parent_tag='google_chrome', sync_type=SEARCH_ENGINE), 411 parent_tag='google_chrome', sync_type=SEARCH_ENGINE),
406 PermanentItem('google_chrome_sessions', name='Sessions', 412 PermanentItem('google_chrome_sessions', name='Sessions',
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1182
1177 update_sieve.CheckMigrationState() 1183 update_sieve.CheckMigrationState()
1178 1184
1179 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) 1185 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve)
1180 1186
1181 update_response.changes_remaining = remaining 1187 update_response.changes_remaining = remaining
1182 for entry in entries: 1188 for entry in entries:
1183 reply = update_response.entries.add() 1189 reply = update_response.entries.add()
1184 reply.CopyFrom(entry) 1190 reply.CopyFrom(entry)
1185 update_sieve.SaveProgress(new_timestamp, update_response) 1191 update_sieve.SaveProgress(new_timestamp, update_response)
OLDNEW
« chrome/browser/sync/syncable/model_type.cc ('K') | « chrome/common/pref_names.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698