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

Side by Side Diff: sync/engine/nigori_util.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 | « sync/engine/net/url_translator.cc ('k') | sync/engine/nigori_util.cc » ('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 (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 // Various utility methods for nigori-based multi-type encryption. 5 // Various utility methods for nigori-based multi-type encryption.
6 6
7 #ifndef SYNC_ENGINE_NIGORI_UTIL_H_ 7 #ifndef SYNC_ENGINE_NIGORI_UTIL_H_
8 #define SYNC_ENGINE_NIGORI_UTIL_H_ 8 #define SYNC_ENGINE_NIGORI_UTIL_H_
9 #pragma once 9 #pragma once
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "sync/internal_api/public/syncable/model_type.h" 12 #include "sync/internal_api/public/syncable/model_type.h"
13 #include "sync/protocol/nigori_specifics.pb.h" 13 #include "sync/protocol/nigori_specifics.pb.h"
14 14
15 namespace csync { 15 namespace syncer {
16 class Cryptographer; 16 class Cryptographer;
17 } 17 }
18 18
19 namespace sync_pb { 19 namespace sync_pb {
20 class EntitySpecifics; 20 class EntitySpecifics;
21 } 21 }
22 22
23 namespace syncable { 23 namespace syncable {
24 24
25 const char kEncryptedString[] = "encrypted"; 25 const char kEncryptedString[] = "encrypted";
(...skipping 10 matching lines...) Expand all
36 // This method is similar to ProcessUnsyncedChangesForEncryption but does not 36 // This method is similar to ProcessUnsyncedChangesForEncryption but does not
37 // modify the data and does not care if data is unnecessarily encrypted. 37 // modify the data and does not care if data is unnecessarily encrypted.
38 bool VerifyUnsyncedChangesAreEncrypted( 38 bool VerifyUnsyncedChangesAreEncrypted(
39 BaseTransaction* const trans, 39 BaseTransaction* const trans,
40 ModelTypeSet encrypted_types); 40 ModelTypeSet encrypted_types);
41 41
42 // Processes all unsynced changes and ensures they are appropriately encrypted 42 // Processes all unsynced changes and ensures they are appropriately encrypted
43 // or unencrypted, based on |encrypted_types|. 43 // or unencrypted, based on |encrypted_types|.
44 bool ProcessUnsyncedChangesForEncryption( 44 bool ProcessUnsyncedChangesForEncryption(
45 WriteTransaction* const trans, 45 WriteTransaction* const trans,
46 csync::Cryptographer* cryptographer); 46 syncer::Cryptographer* cryptographer);
47 47
48 // Returns true if the entry requires encryption but is not encrypted, false 48 // Returns true if the entry requires encryption but is not encrypted, false
49 // otherwise. Note: this does not check that already encrypted entries are 49 // otherwise. Note: this does not check that already encrypted entries are
50 // encrypted with the proper key. 50 // encrypted with the proper key.
51 bool EntryNeedsEncryption(ModelTypeSet encrypted_types, 51 bool EntryNeedsEncryption(ModelTypeSet encrypted_types,
52 const Entry& entry); 52 const Entry& entry);
53 53
54 // Same as EntryNeedsEncryption, but looks at specifics. 54 // Same as EntryNeedsEncryption, but looks at specifics.
55 bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, 55 bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types,
56 const sync_pb::EntitySpecifics& specifics); 56 const sync_pb::EntitySpecifics& specifics);
57 57
58 // Verifies all data of type |type| is encrypted appropriately. 58 // Verifies all data of type |type| is encrypted appropriately.
59 bool VerifyDataTypeEncryptionForTest( 59 bool VerifyDataTypeEncryptionForTest(
60 BaseTransaction* const trans, 60 BaseTransaction* const trans,
61 csync::Cryptographer* cryptographer, 61 syncer::Cryptographer* cryptographer,
62 ModelType type, 62 ModelType type,
63 bool is_encrypted) WARN_UNUSED_RESULT; 63 bool is_encrypted) WARN_UNUSED_RESULT;
64 64
65 // Stores |new_specifics| into |entry|, encrypting if necessary. 65 // Stores |new_specifics| into |entry|, encrypting if necessary.
66 // Returns false if an error encrypting occurred (does not modify |entry|). 66 // Returns false if an error encrypting occurred (does not modify |entry|).
67 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). 67 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS).
68 bool UpdateEntryWithEncryption( 68 bool UpdateEntryWithEncryption(
69 csync::Cryptographer* cryptographer, 69 syncer::Cryptographer* cryptographer,
70 const sync_pb::EntitySpecifics& new_specifics, 70 const sync_pb::EntitySpecifics& new_specifics,
71 MutableEntry* entry); 71 MutableEntry* entry);
72 72
73 } // namespace syncable 73 } // namespace syncable
74 74
75 #endif // SYNC_ENGINE_NIGORI_UTIL_H_ 75 #endif // SYNC_ENGINE_NIGORI_UTIL_H_
OLDNEW
« no previous file with comments | « sync/engine/net/url_translator.cc ('k') | sync/engine/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698