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

Side by Side Diff: chrome/browser/sync/syncable/nigori_util.h

Issue 7806005: Revert 98770 - Merge 98758 - [Sync] Gracefully handle writing to a node when the cryptographer is... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 nigory-based multi-type encryption. 5 // Various utility methods for nigory-based multi-type encryption.
6 6
7 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ 7 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_
8 #define CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ 8 #define CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_
9 #pragma once 9 #pragma once
10 10
11 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" 11 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h"
12 #include "chrome/browser/sync/syncable/model_type.h" 12 #include "chrome/browser/sync/syncable/model_type.h"
13 13
14 namespace browser_sync { 14 namespace browser_sync {
15 class Cryptographer; 15 class Cryptographer;
16 } 16 }
17 17
18 namespace sync_pb {
19 class EntitySpecifics;
20 }
21
22 namespace syncable { 18 namespace syncable {
23 19
24 const char kEncryptedString[] = "encrypted"; 20 const char kEncryptedString[] = "encrypted";
25 21
26 class BaseTransaction; 22 class BaseTransaction;
27 class Entry;
28 class ReadTransaction; 23 class ReadTransaction;
29 class WriteTransaction; 24 class WriteTransaction;
30 25
31 // Set the encrypted datatypes on the nigori node. 26 // Set the encrypted datatypes on the nigori node.
32 void FillNigoriEncryptedTypes(const ModelTypeSet& types, 27 void FillNigoriEncryptedTypes(const ModelTypeSet& types,
33 sync_pb::NigoriSpecifics* nigori); 28 sync_pb::NigoriSpecifics* nigori);
34 29
35 // Check if our unsyced changes are encrypted if they need to be based on 30 // Check if our unsyced changes are encrypted if they need to be based on
36 // |encrypted_types|. 31 // |encrypted_types|.
37 // Returns: true if all unsynced data that should be encrypted is. 32 // Returns: true if all unsynced data that should be encrypted is.
38 // false if some unsynced changes need to be encrypted. 33 // false if some unsynced changes need to be encrypted.
39 // This method is similar to ProcessUnsyncedChangesForEncryption but does not 34 // This method is similar to ProcessUnsyncedChangesForEncryption but does not
40 // modify the data and does not care if data is unnecessarily encrypted. 35 // modify the data and does not care if data is unnecessarily encrypted.
41 bool VerifyUnsyncedChangesAreEncrypted( 36 bool VerifyUnsyncedChangesAreEncrypted(
42 BaseTransaction* const trans, 37 BaseTransaction* const trans,
43 const ModelTypeSet& encrypted_types); 38 const ModelTypeSet& encrypted_types);
44 39
45 // Processes all unsynced changes and ensures they are appropriately encrypted 40 // Processes all unsynced changes and ensures they are appropriately encrypted
46 // or unencrypted, based on |encrypted_types|. 41 // or unencrypted, based on |encrypted_types|.
47 bool ProcessUnsyncedChangesForEncryption( 42 bool ProcessUnsyncedChangesForEncryption(
48 WriteTransaction* const trans, 43 WriteTransaction* const trans,
49 browser_sync::Cryptographer* cryptographer); 44 browser_sync::Cryptographer* cryptographer);
50 45
51 // Returns true if the entry requires encryption but is not encrypted, false
52 // otherwise. Note: this does not check that already encrypted entries are
53 // encrypted with the proper key.
54 bool EntryNeedsEncryption(const ModelTypeSet& encrypted_types,
55 const Entry& entry);
56
57 // Same as EntryNeedsEncryption, but looks at specifics.
58 bool SpecificsNeedsEncryption(const ModelTypeSet& encrypted_types,
59 const sync_pb::EntitySpecifics& specifics);
60
61 // Verifies all data of type |type| is encrypted appropriately. 46 // Verifies all data of type |type| is encrypted appropriately.
62 bool VerifyDataTypeEncryption(BaseTransaction* const trans, 47 bool VerifyDataTypeEncryption(BaseTransaction* const trans,
63 browser_sync::Cryptographer* cryptographer, 48 browser_sync::Cryptographer* cryptographer,
64 ModelType type, 49 ModelType type,
65 bool is_encrypted); 50 bool is_encrypted);
66 51
67 } // namespace syncable 52 } // namespace syncable
68 53
69 #endif // CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ 54 #endif // CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/sync/syncable/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698