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

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

Issue 809073005: replace COMPILE_ASSERT with static_assert in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit Created 5 years, 11 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
« no previous file with comments | « sync/syncable/model_type.cc ('k') | sync/syncable/syncable_columns.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/syncable/nigori_util.h" 5 #include "sync/syncable/nigori_util.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 << ModelTypeToString(type) 236 << ModelTypeToString(type)
237 << " and marking for syncing."; 237 << " and marking for syncing.";
238 syncable::MarkForSyncing(entry); 238 syncable::MarkForSyncing(entry);
239 return true; 239 return true;
240 } 240 }
241 241
242 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, 242 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
243 bool encrypt_everything, 243 bool encrypt_everything,
244 sync_pb::NigoriSpecifics* nigori) { 244 sync_pb::NigoriSpecifics* nigori) {
245 nigori->set_encrypt_everything(encrypt_everything); 245 nigori->set_encrypt_everything(encrypt_everything);
246 COMPILE_ASSERT(34 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); 246 static_assert(34 == MODEL_TYPE_COUNT, "update encrypted types");
247 nigori->set_encrypt_bookmarks( 247 nigori->set_encrypt_bookmarks(
248 encrypted_types.Has(BOOKMARKS)); 248 encrypted_types.Has(BOOKMARKS));
249 nigori->set_encrypt_preferences( 249 nigori->set_encrypt_preferences(
250 encrypted_types.Has(PREFERENCES)); 250 encrypted_types.Has(PREFERENCES));
251 nigori->set_encrypt_autofill_profile( 251 nigori->set_encrypt_autofill_profile(
252 encrypted_types.Has(AUTOFILL_PROFILE)); 252 encrypted_types.Has(AUTOFILL_PROFILE));
253 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); 253 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL));
254 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); 254 nigori->set_encrypt_themes(encrypted_types.Has(THEMES));
255 nigori->set_encrypt_typed_urls( 255 nigori->set_encrypt_typed_urls(
256 encrypted_types.Has(TYPED_URLS)); 256 encrypted_types.Has(TYPED_URLS));
(...skipping 15 matching lines...) Expand all
272 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); 272 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES));
273 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); 273 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST));
274 } 274 }
275 275
276 ModelTypeSet GetEncryptedTypesFromNigori( 276 ModelTypeSet GetEncryptedTypesFromNigori(
277 const sync_pb::NigoriSpecifics& nigori) { 277 const sync_pb::NigoriSpecifics& nigori) {
278 if (nigori.encrypt_everything()) 278 if (nigori.encrypt_everything())
279 return ModelTypeSet::All(); 279 return ModelTypeSet::All();
280 280
281 ModelTypeSet encrypted_types; 281 ModelTypeSet encrypted_types;
282 COMPILE_ASSERT(34 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); 282 static_assert(34 == MODEL_TYPE_COUNT, "update encrypted types");
283 if (nigori.encrypt_bookmarks()) 283 if (nigori.encrypt_bookmarks())
284 encrypted_types.Put(BOOKMARKS); 284 encrypted_types.Put(BOOKMARKS);
285 if (nigori.encrypt_preferences()) 285 if (nigori.encrypt_preferences())
286 encrypted_types.Put(PREFERENCES); 286 encrypted_types.Put(PREFERENCES);
287 if (nigori.encrypt_autofill_profile()) 287 if (nigori.encrypt_autofill_profile())
288 encrypted_types.Put(AUTOFILL_PROFILE); 288 encrypted_types.Put(AUTOFILL_PROFILE);
289 if (nigori.encrypt_autofill()) 289 if (nigori.encrypt_autofill())
290 encrypted_types.Put(AUTOFILL); 290 encrypted_types.Put(AUTOFILL);
291 if (nigori.encrypt_themes()) 291 if (nigori.encrypt_themes())
292 encrypted_types.Put(THEMES); 292 encrypted_types.Put(THEMES);
(...skipping 21 matching lines...) Expand all
314 encrypted_types.Put(FAVICON_TRACKING); 314 encrypted_types.Put(FAVICON_TRACKING);
315 if (nigori.encrypt_articles()) 315 if (nigori.encrypt_articles())
316 encrypted_types.Put(ARTICLES); 316 encrypted_types.Put(ARTICLES);
317 if (nigori.encrypt_app_list()) 317 if (nigori.encrypt_app_list())
318 encrypted_types.Put(APP_LIST); 318 encrypted_types.Put(APP_LIST);
319 return encrypted_types; 319 return encrypted_types;
320 } 320 }
321 321
322 } // namespace syncable 322 } // namespace syncable
323 } // namespace syncer 323 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/model_type.cc ('k') | sync/syncable/syncable_columns.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698