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

Side by Side Diff: sync/engine/get_commit_ids_command.cc

Issue 10844005: [Sync] Refactor GetEncryptedTypes usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always trigger OnEncryptedTypesChanged on init Created 8 years, 4 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/engine/get_commit_ids_command.h" 5 #include "sync/engine/get_commit_ids_command.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "sync/engine/syncer_util.h" 11 #include "sync/engine/syncer_util.h"
12 #include "sync/engine/throttled_data_type_tracker.h" 12 #include "sync/engine/throttled_data_type_tracker.h"
13 #include "sync/syncable/entry.h" 13 #include "sync/syncable/entry.h"
14 #include "sync/syncable/mutable_entry.h" 14 #include "sync/syncable/mutable_entry.h"
15 #include "sync/syncable/nigori_handler.h"
15 #include "sync/syncable/nigori_util.h" 16 #include "sync/syncable/nigori_util.h"
16 #include "sync/syncable/syncable_util.h" 17 #include "sync/syncable/syncable_util.h"
17 #include "sync/syncable/write_transaction.h" 18 #include "sync/syncable/write_transaction.h"
18 #include "sync/util/cryptographer.h" 19 #include "sync/util/cryptographer.h"
19 20
20 using std::set; 21 using std::set;
21 using std::vector; 22 using std::vector;
22 23
23 namespace syncer { 24 namespace syncer {
24 25
(...skipping 17 matching lines...) Expand all
42 syncable::Directory::UnsyncedMetaHandles all_unsynced_handles; 43 syncable::Directory::UnsyncedMetaHandles all_unsynced_handles;
43 GetUnsyncedEntries(session->write_transaction(), 44 GetUnsyncedEntries(session->write_transaction(),
44 &all_unsynced_handles); 45 &all_unsynced_handles);
45 46
46 ModelTypeSet encrypted_types; 47 ModelTypeSet encrypted_types;
47 bool passphrase_missing = false; 48 bool passphrase_missing = false;
48 Cryptographer* cryptographer = 49 Cryptographer* cryptographer =
49 session->context()-> 50 session->context()->
50 directory()->GetCryptographer(session->write_transaction()); 51 directory()->GetCryptographer(session->write_transaction());
51 if (cryptographer) { 52 if (cryptographer) {
52 encrypted_types = cryptographer->GetEncryptedTypes(); 53 encrypted_types = session->context()->directory()->GetNigoriHandler()->
54 GetEncryptedTypes(session->write_transaction());
53 passphrase_missing = cryptographer->has_pending_keys(); 55 passphrase_missing = cryptographer->has_pending_keys();
54 }; 56 };
55 57
56 const ModelTypeSet throttled_types = 58 const ModelTypeSet throttled_types =
57 session->context()->throttled_data_type_tracker()->GetThrottledTypes(); 59 session->context()->throttled_data_type_tracker()->GetThrottledTypes();
58 // We filter out all unready entries from the set of unsynced handles. This 60 // We filter out all unready entries from the set of unsynced handles. This
59 // new set of ready and unsynced items (which excludes throttled items as 61 // new set of ready and unsynced items (which excludes throttled items as
60 // well) is then what we use to determine what is a candidate for commit. 62 // well) is then what we use to determine what is a candidate for commit.
61 FilterUnreadyEntries(session->write_transaction(), 63 FilterUnreadyEntries(session->write_transaction(),
62 throttled_types, 64 throttled_types,
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // delete trees. 428 // delete trees.
427 429
428 // Add moves and creates, and prepend their uncommitted parents. 430 // Add moves and creates, and prepend their uncommitted parents.
429 AddCreatesAndMoves(write_transaction, routes, ready_unsynced_set); 431 AddCreatesAndMoves(write_transaction, routes, ready_unsynced_set);
430 432
431 // Add all deletes. 433 // Add all deletes.
432 AddDeletes(write_transaction, ready_unsynced_set); 434 AddDeletes(write_transaction, ready_unsynced_set);
433 } 435 }
434 436
435 } // namespace syncer 437 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698