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

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

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Sync to tip. Latest comments. Created 9 years, 3 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
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_setting_specifics_pb2
24 import extension_specifics_pb2 25 import extension_specifics_pb2
25 import nigori_specifics_pb2 26 import nigori_specifics_pb2
26 import password_specifics_pb2 27 import password_specifics_pb2
27 import preference_specifics_pb2 28 import preference_specifics_pb2
28 import search_engine_specifics_pb2 29 import search_engine_specifics_pb2
29 import session_specifics_pb2 30 import session_specifics_pb2
30 import sync_pb2 31 import sync_pb2
31 import theme_specifics_pb2 32 import theme_specifics_pb2
32 import typed_url_specifics_pb2 33 import typed_url_specifics_pb2
33 34
34 # An enumeration of the various kinds of data that can be synced. 35 # An enumeration of the various kinds of data that can be synced.
35 # Over the wire, this enumeration is not used: a sync object's type is 36 # Over the wire, this enumeration is not used: a sync object's type is
36 # inferred by which EntitySpecifics extension it has. But in the context 37 # inferred by which EntitySpecifics extension it has. But in the context
37 # of a program, it is useful to have an enumeration. 38 # of a program, it is useful to have an enumeration.
38 ALL_TYPES = ( 39 ALL_TYPES = (
39 TOP_LEVEL, # The type of the 'Google Chrome' folder. 40 TOP_LEVEL, # The type of the 'Google Chrome' folder.
40 APPS, 41 APPS,
41 AUTOFILL, 42 AUTOFILL,
42 AUTOFILL_PROFILE, 43 AUTOFILL_PROFILE,
43 BOOKMARK, 44 BOOKMARK,
44 EXTENSIONS, 45 EXTENSIONS,
45 NIGORI, 46 NIGORI,
46 PASSWORD, 47 PASSWORD,
47 PREFERENCE, 48 PREFERENCE,
48 SEARCH_ENGINE, 49 SEARCH_ENGINE,
49 SESSION, 50 SESSION,
50 THEME, 51 THEME,
51 TYPED_URL) = range(13) 52 TYPED_URL,
53 EXTENSION_SETTINGS) = range(14)
52 54
53 # Well-known server tag of the top level 'Google Chrome' folder. 55 # Well-known server tag of the top level 'Google Chrome' folder.
54 TOP_LEVEL_FOLDER_TAG = 'google_chrome' 56 TOP_LEVEL_FOLDER_TAG = 'google_chrome'
55 57
56 # Given a sync type from ALL_TYPES, find the extension token corresponding 58 # Given a sync type from ALL_TYPES, find the extension token corresponding
57 # to that datatype. Note that TOP_LEVEL has no such token. 59 # to that datatype. Note that TOP_LEVEL has no such token.
58 SYNC_TYPE_TO_EXTENSION = { 60 SYNC_TYPE_TO_EXTENSION = {
59 APPS: app_specifics_pb2.app, 61 APPS: app_specifics_pb2.app,
60 AUTOFILL: autofill_specifics_pb2.autofill, 62 AUTOFILL: autofill_specifics_pb2.autofill,
61 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile, 63 AUTOFILL_PROFILE: autofill_specifics_pb2.autofill_profile,
62 BOOKMARK: bookmark_specifics_pb2.bookmark, 64 BOOKMARK: bookmark_specifics_pb2.bookmark,
65 EXTENSION_SETTINGS: extension_setting_specifics_pb2.extension_setting,
63 EXTENSIONS: extension_specifics_pb2.extension, 66 EXTENSIONS: extension_specifics_pb2.extension,
64 NIGORI: nigori_specifics_pb2.nigori, 67 NIGORI: nigori_specifics_pb2.nigori,
65 PASSWORD: password_specifics_pb2.password, 68 PASSWORD: password_specifics_pb2.password,
66 PREFERENCE: preference_specifics_pb2.preference, 69 PREFERENCE: preference_specifics_pb2.preference,
67 SEARCH_ENGINE: search_engine_specifics_pb2.search_engine, 70 SEARCH_ENGINE: search_engine_specifics_pb2.search_engine,
68 SESSION: session_specifics_pb2.session, 71 SESSION: session_specifics_pb2.session,
69 THEME: theme_specifics_pb2.theme, 72 THEME: theme_specifics_pb2.theme,
70 TYPED_URL: typed_url_specifics_pb2.typed_url, 73 TYPED_URL: typed_url_specifics_pb2.typed_url,
71 } 74 }
72 75
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 PermanentItem('bookmark_bar', name='Bookmark Bar', 380 PermanentItem('bookmark_bar', name='Bookmark Bar',
378 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 381 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
379 PermanentItem('other_bookmarks', name='Other Bookmarks', 382 PermanentItem('other_bookmarks', name='Other Bookmarks',
380 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 383 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
381 PermanentItem('google_chrome_preferences', name='Preferences', 384 PermanentItem('google_chrome_preferences', name='Preferences',
382 parent_tag='google_chrome', sync_type=PREFERENCE), 385 parent_tag='google_chrome', sync_type=PREFERENCE),
383 PermanentItem('google_chrome_autofill', name='Autofill', 386 PermanentItem('google_chrome_autofill', name='Autofill',
384 parent_tag='google_chrome', sync_type=AUTOFILL), 387 parent_tag='google_chrome', sync_type=AUTOFILL),
385 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', 388 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles',
386 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE), 389 parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE),
390 PermanentItem('google_chrome_extension_settings',
391 name='Extension Settings',
392 parent_tag='google_chrome', sync_type=EXTENSION_SETTINGS),
387 PermanentItem('google_chrome_extensions', name='Extensions', 393 PermanentItem('google_chrome_extensions', name='Extensions',
388 parent_tag='google_chrome', sync_type=EXTENSIONS), 394 parent_tag='google_chrome', sync_type=EXTENSIONS),
389 PermanentItem('google_chrome_passwords', name='Passwords', 395 PermanentItem('google_chrome_passwords', name='Passwords',
390 parent_tag='google_chrome', sync_type=PASSWORD), 396 parent_tag='google_chrome', sync_type=PASSWORD),
391 PermanentItem('google_chrome_search_engines', name='Search Engines', 397 PermanentItem('google_chrome_search_engines', name='Search Engines',
392 parent_tag='google_chrome', sync_type=SEARCH_ENGINE), 398 parent_tag='google_chrome', sync_type=SEARCH_ENGINE),
393 PermanentItem('google_chrome_sessions', name='Sessions', 399 PermanentItem('google_chrome_sessions', name='Sessions',
394 parent_tag='google_chrome', sync_type=SESSION), 400 parent_tag='google_chrome', sync_type=SESSION),
395 PermanentItem('google_chrome_themes', name='Themes', 401 PermanentItem('google_chrome_themes', name='Themes',
396 parent_tag='google_chrome', sync_type=THEME), 402 parent_tag='google_chrome', sync_type=THEME),
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1108
1103 update_sieve.CheckMigrationState() 1109 update_sieve.CheckMigrationState()
1104 1110
1105 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) 1111 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve)
1106 1112
1107 update_response.changes_remaining = remaining 1113 update_response.changes_remaining = remaining
1108 for entry in entries: 1114 for entry in entries:
1109 reply = update_response.entries.add() 1115 reply = update_response.entries.add()
1110 reply.CopyFrom(entry) 1116 reply.CopyFrom(entry)
1111 update_sieve.SaveProgress(new_timestamp, update_response) 1117 update_sieve.SaveProgress(new_timestamp, update_response)
OLDNEW
« chrome/chrome_tests.gypi ('K') | « chrome/test/base/testing_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698