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

Side by Side Diff: components/sync/syncable/nigori_util.cc

Issue 2306763002: Add PrinterSpecifics to the sync protos. (Closed)
Patch Set: PrintersSpecifics -> PrinterSpecifics Created 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include "components/sync/syncable/nigori_util.h" 5 #include "components/sync/syncable/nigori_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <queue> 11 #include <queue>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/json/json_writer.h" 15 #include "base/json/json_writer.h"
15 #include "components/sync/base/cryptographer.h" 16 #include "components/sync/base/cryptographer.h"
16 #include "components/sync/base/passphrase_type.h" 17 #include "components/sync/base/passphrase_type.h"
17 #include "components/sync/syncable/directory.h" 18 #include "components/sync/syncable/directory.h"
18 #include "components/sync/syncable/entry.h" 19 #include "components/sync/syncable/entry.h"
19 #include "components/sync/syncable/mutable_entry.h" 20 #include "components/sync/syncable/mutable_entry.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) 239 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type)
239 << " and marking for syncing."; 240 << " and marking for syncing.";
240 syncable::MarkForSyncing(entry); 241 syncable::MarkForSyncing(entry);
241 return true; 242 return true;
242 } 243 }
243 244
244 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, 245 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
245 bool encrypt_everything, 246 bool encrypt_everything,
246 sync_pb::NigoriSpecifics* nigori) { 247 sync_pb::NigoriSpecifics* nigori) {
247 nigori->set_encrypt_everything(encrypt_everything); 248 nigori->set_encrypt_everything(encrypt_everything);
248 static_assert(37 == MODEL_TYPE_COUNT, "update encrypted types"); 249 static_assert(38 == MODEL_TYPE_COUNT, "update encrypted types");
249 nigori->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS)); 250 nigori->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS));
250 nigori->set_encrypt_preferences(encrypted_types.Has(PREFERENCES)); 251 nigori->set_encrypt_preferences(encrypted_types.Has(PREFERENCES));
251 nigori->set_encrypt_autofill_profile(encrypted_types.Has(AUTOFILL_PROFILE)); 252 nigori->set_encrypt_autofill_profile(encrypted_types.Has(AUTOFILL_PROFILE));
252 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); 253 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL));
253 nigori->set_encrypt_autofill_wallet_metadata( 254 nigori->set_encrypt_autofill_wallet_metadata(
254 encrypted_types.Has(AUTOFILL_WALLET_METADATA)); 255 encrypted_types.Has(AUTOFILL_WALLET_METADATA));
255 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); 256 nigori->set_encrypt_themes(encrypted_types.Has(THEMES));
256 nigori->set_encrypt_typed_urls(encrypted_types.Has(TYPED_URLS)); 257 nigori->set_encrypt_typed_urls(encrypted_types.Has(TYPED_URLS));
257 nigori->set_encrypt_extension_settings( 258 nigori->set_encrypt_extension_settings(
258 encrypted_types.Has(EXTENSION_SETTINGS)); 259 encrypted_types.Has(EXTENSION_SETTINGS));
259 nigori->set_encrypt_extensions(encrypted_types.Has(EXTENSIONS)); 260 nigori->set_encrypt_extensions(encrypted_types.Has(EXTENSIONS));
260 nigori->set_encrypt_search_engines(encrypted_types.Has(SEARCH_ENGINES)); 261 nigori->set_encrypt_search_engines(encrypted_types.Has(SEARCH_ENGINES));
261 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS)); 262 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS));
262 nigori->set_encrypt_app_settings(encrypted_types.Has(APP_SETTINGS)); 263 nigori->set_encrypt_app_settings(encrypted_types.Has(APP_SETTINGS));
263 nigori->set_encrypt_apps(encrypted_types.Has(APPS)); 264 nigori->set_encrypt_apps(encrypted_types.Has(APPS));
264 nigori->set_encrypt_app_notifications(encrypted_types.Has(APP_NOTIFICATIONS)); 265 nigori->set_encrypt_app_notifications(encrypted_types.Has(APP_NOTIFICATIONS));
265 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY)); 266 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY));
266 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); 267 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES));
267 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); 268 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING));
268 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); 269 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES));
269 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); 270 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST));
270 nigori->set_encrypt_arc_package(encrypted_types.Has(ARC_PACKAGE)); 271 nigori->set_encrypt_arc_package(encrypted_types.Has(ARC_PACKAGE));
272 nigori->set_encrypt_printers(encrypted_types.Has(PRINTERS));
271 } 273 }
272 274
273 ModelTypeSet GetEncryptedTypesFromNigori( 275 ModelTypeSet GetEncryptedTypesFromNigori(
274 const sync_pb::NigoriSpecifics& nigori) { 276 const sync_pb::NigoriSpecifics& nigori) {
275 if (nigori.encrypt_everything()) 277 if (nigori.encrypt_everything())
276 return ModelTypeSet::All(); 278 return ModelTypeSet::All();
277 279
278 ModelTypeSet encrypted_types; 280 ModelTypeSet encrypted_types;
279 static_assert(37 == MODEL_TYPE_COUNT, "update encrypted types"); 281 static_assert(38 == MODEL_TYPE_COUNT, "update encrypted types");
280 if (nigori.encrypt_bookmarks()) 282 if (nigori.encrypt_bookmarks())
281 encrypted_types.Put(BOOKMARKS); 283 encrypted_types.Put(BOOKMARKS);
282 if (nigori.encrypt_preferences()) 284 if (nigori.encrypt_preferences())
283 encrypted_types.Put(PREFERENCES); 285 encrypted_types.Put(PREFERENCES);
284 if (nigori.encrypt_autofill_profile()) 286 if (nigori.encrypt_autofill_profile())
285 encrypted_types.Put(AUTOFILL_PROFILE); 287 encrypted_types.Put(AUTOFILL_PROFILE);
286 if (nigori.encrypt_autofill()) 288 if (nigori.encrypt_autofill())
287 encrypted_types.Put(AUTOFILL); 289 encrypted_types.Put(AUTOFILL);
288 if (nigori.encrypt_autofill_wallet_metadata()) 290 if (nigori.encrypt_autofill_wallet_metadata())
289 encrypted_types.Put(AUTOFILL_WALLET_METADATA); 291 encrypted_types.Put(AUTOFILL_WALLET_METADATA);
(...skipping 20 matching lines...) Expand all
310 if (nigori.encrypt_favicon_images()) 312 if (nigori.encrypt_favicon_images())
311 encrypted_types.Put(FAVICON_IMAGES); 313 encrypted_types.Put(FAVICON_IMAGES);
312 if (nigori.encrypt_favicon_tracking()) 314 if (nigori.encrypt_favicon_tracking())
313 encrypted_types.Put(FAVICON_TRACKING); 315 encrypted_types.Put(FAVICON_TRACKING);
314 if (nigori.encrypt_articles()) 316 if (nigori.encrypt_articles())
315 encrypted_types.Put(ARTICLES); 317 encrypted_types.Put(ARTICLES);
316 if (nigori.encrypt_app_list()) 318 if (nigori.encrypt_app_list())
317 encrypted_types.Put(APP_LIST); 319 encrypted_types.Put(APP_LIST);
318 if (nigori.encrypt_arc_package()) 320 if (nigori.encrypt_arc_package())
319 encrypted_types.Put(ARC_PACKAGE); 321 encrypted_types.Put(ARC_PACKAGE);
322 if (nigori.encrypt_printers())
323 encrypted_types.Put(PRINTERS);
320 return encrypted_types; 324 return encrypted_types;
321 } 325 }
322 326
323 } // namespace syncable 327 } // namespace syncable
324 } // namespace syncer 328 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/model_type_unittest.cc ('k') | components/sync/tools/testserver/chromiumsync.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698