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

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

Issue 7150023: Add protobuffer and model type for syncing custom search engines. Includes all boilerplate helper... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months 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
« no previous file with comments | « chrome/browser/sync/util/cryptographer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_specifics_pb2 21 import app_specifics_pb2
22 import autofill_specifics_pb2 22 import autofill_specifics_pb2
23 import bookmark_specifics_pb2 23 import bookmark_specifics_pb2
24 import extension_specifics_pb2 24 import extension_specifics_pb2
25 import nigori_specifics_pb2 25 import nigori_specifics_pb2
26 import password_specifics_pb2 26 import password_specifics_pb2
27 import preference_specifics_pb2 27 import preference_specifics_pb2
28 import search_engine_specifics_pb2
28 import session_specifics_pb2 29 import session_specifics_pb2
29 import sync_pb2 30 import sync_pb2
30 import theme_specifics_pb2 31 import theme_specifics_pb2
31 import typed_url_specifics_pb2 32 import typed_url_specifics_pb2
32 33
33 # An enumeration of the various kinds of data that can be synced. 34 # An enumeration of the various kinds of data that can be synced.
34 # Over the wire, this enumeration is not used: a sync object's type is 35 # Over the wire, this enumeration is not used: a sync object's type is
35 # inferred by which EntitySpecifics extension it has. But in the context 36 # inferred by which EntitySpecifics extension it has. But in the context
36 # of a program, it is useful to have an enumeration. 37 # of a program, it is useful to have an enumeration.
37 ALL_TYPES = ( 38 ALL_TYPES = (
38 TOP_LEVEL, # The type of the 'Google Chrome' folder. 39 TOP_LEVEL, # The type of the 'Google Chrome' folder.
39 APPS, 40 APPS,
40 AUTOFILL, 41 AUTOFILL,
41 AUTOFILL_PROFILE, 42 AUTOFILL_PROFILE,
42 BOOKMARK, 43 BOOKMARK,
43 EXTENSIONS, 44 EXTENSIONS,
44 NIGORI, 45 NIGORI,
45 PASSWORD, 46 PASSWORD,
46 PREFERENCE, 47 PREFERENCE,
48 SEARCH_ENGINE,
47 SESSION, 49 SESSION,
48 THEME, 50 THEME,
49 TYPED_URL) = range(12) 51 TYPED_URL) = range(13)
50 52
51 # Well-known server tag of the top level 'Google Chrome' folder. 53 # Well-known server tag of the top level 'Google Chrome' folder.
52 TOP_LEVEL_FOLDER_TAG = 'google_chrome' 54 TOP_LEVEL_FOLDER_TAG = 'google_chrome'
53 55
54 # Given a sync type from ALL_TYPES, find the extension token corresponding 56 # Given a sync type from ALL_TYPES, find the extension token corresponding
55 # to that datatype. Note that TOP_LEVEL has no such token. 57 # to that datatype. Note that TOP_LEVEL has no such token.
56 SYNC_TYPE_TO_EXTENSION = { 58 SYNC_TYPE_TO_EXTENSION = {
57 APPS: app_specifics_pb2.app, 59 APPS: app_specifics_pb2.app,
58 AUTOFILL: autofill_specifics_pb2.autofill, 60 AUTOFILL: autofill_specifics_pb2.autofill,
59 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile, 61 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile,
60 BOOKMARK: bookmark_specifics_pb2.bookmark, 62 BOOKMARK: bookmark_specifics_pb2.bookmark,
61 EXTENSIONS: extension_specifics_pb2.extension, 63 EXTENSIONS: extension_specifics_pb2.extension,
62 NIGORI: nigori_specifics_pb2.nigori, 64 NIGORI: nigori_specifics_pb2.nigori,
63 PASSWORD: password_specifics_pb2.password, 65 PASSWORD: password_specifics_pb2.password,
64 PREFERENCE: preference_specifics_pb2.preference, 66 PREFERENCE: preference_specifics_pb2.preference,
67 SEARCH_ENGINE: search_engine_specifics_pb2.search_engine,
65 SESSION: session_specifics_pb2.session, 68 SESSION: session_specifics_pb2.session,
66 THEME: theme_specifics_pb2.theme, 69 THEME: theme_specifics_pb2.theme,
67 TYPED_URL: typed_url_specifics_pb2.typed_url, 70 TYPED_URL: typed_url_specifics_pb2.typed_url,
68 } 71 }
69 72
70 # The parent ID used to indicate a top-level node. 73 # The parent ID used to indicate a top-level node.
71 ROOT_ID = '0' 74 ROOT_ID = '0'
72 75
73 76
74 class Error(Exception): 77 class Error(Exception):
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 PermanentItem('google_chrome_preferences', name='Preferences', 377 PermanentItem('google_chrome_preferences', name='Preferences',
375 parent_tag='google_chrome', sync_type=PREFERENCE), 378 parent_tag='google_chrome', sync_type=PREFERENCE),
376 PermanentItem('google_chrome_autofill', name='Autofill', 379 PermanentItem('google_chrome_autofill', name='Autofill',
377 parent_tag='google_chrome', sync_type=AUTOFILL), 380 parent_tag='google_chrome', sync_type=AUTOFILL),
378 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', 381 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles',
379 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE), 382 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE),
380 PermanentItem('google_chrome_extensions', name='Extensions', 383 PermanentItem('google_chrome_extensions', name='Extensions',
381 parent_tag='google_chrome', sync_type=EXTENSIONS), 384 parent_tag='google_chrome', sync_type=EXTENSIONS),
382 PermanentItem('google_chrome_passwords', name='Passwords', 385 PermanentItem('google_chrome_passwords', name='Passwords',
383 parent_tag='google_chrome', sync_type=PASSWORD), 386 parent_tag='google_chrome', sync_type=PASSWORD),
387 PermanentItem('google_chrome_search_engines', name='Search Engines',
388 parent_tag='google_chrome', sync_type=SEARCH_ENGINE),
384 PermanentItem('google_chrome_sessions', name='Sessions', 389 PermanentItem('google_chrome_sessions', name='Sessions',
385 parent_tag='google_chrome', sync_type=SESSION), 390 parent_tag='google_chrome', sync_type=SESSION),
386 PermanentItem('google_chrome_themes', name='Themes', 391 PermanentItem('google_chrome_themes', name='Themes',
387 parent_tag='google_chrome', sync_type=THEME), 392 parent_tag='google_chrome', sync_type=THEME),
388 PermanentItem('google_chrome_typed_urls', name='Typed URLs', 393 PermanentItem('google_chrome_typed_urls', name='Typed URLs',
389 parent_tag='google_chrome', sync_type=TYPED_URL), 394 parent_tag='google_chrome', sync_type=TYPED_URL),
390 PermanentItem('google_chrome_nigori', name='Nigori', 395 PermanentItem('google_chrome_nigori', name='Nigori',
391 parent_tag='google_chrome', sync_type=NIGORI), 396 parent_tag='google_chrome', sync_type=NIGORI),
392 PermanentItem('google_chrome_apps', name='Apps', 397 PermanentItem('google_chrome_apps', name='Apps',
393 parent_tag='google_chrome', sync_type=APPS), 398 parent_tag='google_chrome', sync_type=APPS),
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1087
1083 update_sieve.CheckMigrationState() 1088 update_sieve.CheckMigrationState()
1084 1089
1085 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) 1090 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve)
1086 1091
1087 update_response.changes_remaining = remaining 1092 update_response.changes_remaining = remaining
1088 for entry in entries: 1093 for entry in entries:
1089 reply = update_response.entries.add() 1094 reply = update_response.entries.add()
1090 reply.CopyFrom(entry) 1095 reply.CopyFrom(entry)
1091 update_sieve.SaveProgress(new_timestamp, update_response) 1096 update_sieve.SaveProgress(new_timestamp, update_response)
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/cryptographer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698