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

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl.h

Issue 10824410: [Sync] Refactor passphrase state handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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) 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 #ifndef SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ 5 #ifndef SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_
6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ 6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // SyncEncryptionHandler implementation. 51 // SyncEncryptionHandler implementation.
52 virtual void AddObserver(Observer* observer) OVERRIDE; 52 virtual void AddObserver(Observer* observer) OVERRIDE;
53 virtual void RemoveObserver(Observer* observer) OVERRIDE; 53 virtual void RemoveObserver(Observer* observer) OVERRIDE;
54 virtual void Init() OVERRIDE; 54 virtual void Init() OVERRIDE;
55 virtual void SetEncryptionPassphrase(const std::string& passphrase, 55 virtual void SetEncryptionPassphrase(const std::string& passphrase,
56 bool is_explicit) OVERRIDE; 56 bool is_explicit) OVERRIDE;
57 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; 57 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE;
58 virtual void EnableEncryptEverything() OVERRIDE; 58 virtual void EnableEncryptEverything() OVERRIDE;
59 virtual bool EncryptEverythingEnabled() const OVERRIDE; 59 virtual bool EncryptEverythingEnabled() const OVERRIDE;
60 // Can be called from any thread. 60 virtual PassphraseState GetPassphraseState() const OVERRIDE;
61 // TODO(zea): enforce this is only called on sync thread.
62 virtual bool IsUsingExplicitPassphrase() const OVERRIDE;
63 61
64 // NigoriHandler implementation. 62 // NigoriHandler implementation.
65 // Note: all methods are invoked while the caller holds a transaction. 63 // Note: all methods are invoked while the caller holds a transaction.
66 virtual void ApplyNigoriUpdate( 64 virtual void ApplyNigoriUpdate(
67 const sync_pb::NigoriSpecifics& nigori, 65 const sync_pb::NigoriSpecifics& nigori,
68 syncable::BaseTransaction* const trans) OVERRIDE; 66 syncable::BaseTransaction* const trans) OVERRIDE;
69 virtual void UpdateNigoriFromEncryptedTypes( 67 virtual void UpdateNigoriFromEncryptedTypes(
70 sync_pb::NigoriSpecifics* nigori, 68 sync_pb::NigoriSpecifics* nigori,
71 syncable::BaseTransaction* const trans) const OVERRIDE; 69 syncable::BaseTransaction* const trans) const OVERRIDE;
72 // Can be called from any thread. 70 // Can be called from any thread.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 171
174 // Container for all data that can be accessed from multiple threads. Do not 172 // Container for all data that can be accessed from multiple threads. Do not
175 // access this object directly. Instead access it via UnlockVault(..) and 173 // access this object directly. Instead access it via UnlockVault(..) and
176 // UnlockVaultMutable(..). 174 // UnlockVaultMutable(..).
177 Vault vault_unsafe_; 175 Vault vault_unsafe_;
178 176
179 // Sync encryption state that is only modified and accessed from the sync 177 // Sync encryption state that is only modified and accessed from the sync
180 // thread. 178 // thread.
181 // Whether all current and future types should be encrypted. 179 // Whether all current and future types should be encrypted.
182 bool encrypt_everything_; 180 bool encrypt_everything_;
183 // Whether the user is using a custom passphrase for encryption. 181 // The current state of the passphrase required to decrypt the encryption
184 bool explicit_passphrase_; 182 // keys stored in the nigori node.
183 PassphraseState passphrase_state_;
185 184
186 // The number of times we've automatically (i.e. not via SetPassphrase or 185 // The number of times we've automatically (i.e. not via SetPassphrase or
187 // conflict resolver) updated the nigori's encryption keys in this chrome 186 // conflict resolver) updated the nigori's encryption keys in this chrome
188 // instantiation. 187 // instantiation.
189 int nigori_overwrite_count_; 188 int nigori_overwrite_count_;
190 189
191 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); 190 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl);
192 }; 191 };
193 192
194 } // namespace syncer 193 } // namespace syncer
195 194
196 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ 195 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/util/sync_string_conversions.cc ('k') | sync/internal_api/sync_encryption_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698