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

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

Issue 10917246: [Sync] Add keystore encryption info to about:sync (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"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/time.h"
12 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "sync/internal_api/public/sync_encryption_handler.h" 17 #include "sync/internal_api/public/sync_encryption_handler.h"
17 #include "sync/syncable/nigori_handler.h" 18 #include "sync/syncable/nigori_handler.h"
18 #include "sync/util/cryptographer.h" 19 #include "sync/util/cryptographer.h"
19 20
20 namespace syncer { 21 namespace syncer {
21 22
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 virtual void AddObserver(Observer* observer) OVERRIDE; 56 virtual void AddObserver(Observer* observer) OVERRIDE;
56 virtual void RemoveObserver(Observer* observer) OVERRIDE; 57 virtual void RemoveObserver(Observer* observer) OVERRIDE;
57 virtual void Init() OVERRIDE; 58 virtual void Init() OVERRIDE;
58 virtual void SetEncryptionPassphrase(const std::string& passphrase, 59 virtual void SetEncryptionPassphrase(const std::string& passphrase,
59 bool is_explicit) OVERRIDE; 60 bool is_explicit) OVERRIDE;
60 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; 61 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE;
61 virtual void EnableEncryptEverything() OVERRIDE; 62 virtual void EnableEncryptEverything() OVERRIDE;
62 virtual bool EncryptEverythingEnabled() const OVERRIDE; 63 virtual bool EncryptEverythingEnabled() const OVERRIDE;
63 virtual PassphraseType GetPassphraseType() const OVERRIDE; 64 virtual PassphraseType GetPassphraseType() const OVERRIDE;
64 65
65 // TODO(zea): provide a method for getting the time at which the nigori
66 // node was migrated.
67
68 // NigoriHandler implementation. 66 // NigoriHandler implementation.
69 // Note: all methods are invoked while the caller holds a transaction. 67 // Note: all methods are invoked while the caller holds a transaction.
70 virtual void ApplyNigoriUpdate( 68 virtual void ApplyNigoriUpdate(
71 const sync_pb::NigoriSpecifics& nigori, 69 const sync_pb::NigoriSpecifics& nigori,
72 syncable::BaseTransaction* const trans) OVERRIDE; 70 syncable::BaseTransaction* const trans) OVERRIDE;
73 virtual void UpdateNigoriFromEncryptedTypes( 71 virtual void UpdateNigoriFromEncryptedTypes(
74 sync_pb::NigoriSpecifics* nigori, 72 sync_pb::NigoriSpecifics* nigori,
75 syncable::BaseTransaction* const trans) const OVERRIDE; 73 syncable::BaseTransaction* const trans) const OVERRIDE;
76 virtual bool NeedKeystoreKey( 74 virtual bool NeedKeystoreKey(
77 syncable::BaseTransaction* const trans) const OVERRIDE; 75 syncable::BaseTransaction* const trans) const OVERRIDE;
78 virtual bool SetKeystoreKey( 76 virtual bool SetKeystoreKey(
79 const std::string& key, 77 const std::string& key,
80 syncable::BaseTransaction* const trans) OVERRIDE; 78 syncable::BaseTransaction* const trans) OVERRIDE;
81 // Can be called from any thread. 79 // Can be called from any thread.
82 virtual ModelTypeSet GetEncryptedTypes( 80 virtual ModelTypeSet GetEncryptedTypes(
83 syncable::BaseTransaction* const trans) const OVERRIDE; 81 syncable::BaseTransaction* const trans) const OVERRIDE;
84 82
85 // Unsafe getters. Use only if sync is not up and running and there is no risk 83 // Unsafe getters. Use only if sync is not up and running and there is no risk
86 // of other threads calling this. 84 // of other threads calling this.
87 Cryptographer* GetCryptographerUnsafe(); 85 Cryptographer* GetCryptographerUnsafe();
88 ModelTypeSet GetEncryptedTypesUnsafe(); 86 ModelTypeSet GetEncryptedTypesUnsafe();
89 87
90 bool MigratedToKeystore(); 88 bool MigratedToKeystore();
89 base::Time migration_time() const;
91 90
92 private: 91 private:
93 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, 92 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest,
94 NigoriEncryptionTypes); 93 NigoriEncryptionTypes);
95 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, 94 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest,
96 EncryptEverythingExplicit); 95 EncryptEverythingExplicit);
97 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, 96 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest,
98 EncryptEverythingImplicit); 97 EncryptEverythingImplicit);
99 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, 98 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest,
100 UnknownSensitiveTypes); 99 UnknownSensitiveTypes);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 PassphraseType passphrase_type_; 279 PassphraseType passphrase_type_;
281 280
282 // The keystore key provided by the server. 281 // The keystore key provided by the server.
283 std::string keystore_key_; 282 std::string keystore_key_;
284 283
285 // The number of times we've automatically (i.e. not via SetPassphrase or 284 // The number of times we've automatically (i.e. not via SetPassphrase or
286 // conflict resolver) updated the nigori's encryption keys in this chrome 285 // conflict resolver) updated the nigori's encryption keys in this chrome
287 // instantiation. 286 // instantiation.
288 int nigori_overwrite_count_; 287 int nigori_overwrite_count_;
289 288
290 // The time (in ms) the nigori was migrated to support keystore encryption. 289 // The time the nigori was migrated to support keystore encryption.
291 int64 migration_time_ms_; 290 base::Time migration_time_;
292 291
293 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); 292 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl);
294 }; 293 };
295 294
296 } // namespace syncer 295 } // namespace syncer
297 296
298 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ 297 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/engine/sync_status.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