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

Side by Side Diff: chrome/browser/sync/engine/syncapi.h

Issue 6902101: Refactor sync passphrase setup flow and fix passphrase tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 7 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 // This file defines the "sync API", an interface to the syncer 5 // This file defines the "sync API", an interface to the syncer
6 // backend that exposes (1) the core functionality of maintaining a consistent 6 // backend that exposes (1) the core functionality of maintaining a consistent
7 // local snapshot of a hierarchical object set; (2) a means to transactionally 7 // local snapshot of a hierarchical object set; (2) a means to transactionally
8 // access and modify those objects; (3) a means to control client/server 8 // access and modify those objects; (3) a means to control client/server
9 // synchronization tasks, namely: pushing local object modifications to a 9 // synchronization tasks, namely: pushing local object modifications to a
10 // server, pulling nonlocal object modifications from a server to this client, 10 // server, pulling nonlocal object modifications from a server to this client,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 class TypedUrlSpecifics; 100 class TypedUrlSpecifics;
101 } 101 }
102 102
103 namespace sync_api { 103 namespace sync_api {
104 104
105 class BaseTransaction; 105 class BaseTransaction;
106 class HttpPostProviderFactory; 106 class HttpPostProviderFactory;
107 class SyncManager; 107 class SyncManager;
108 class WriteTransaction; 108 class WriteTransaction;
109 109
110 // Reasons due to which browser_sync::Cryptographer might require a passphrase.
111 enum PassphraseRequiredReason {
112 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value.
113 REASON_ENCRYPTION = 1, // The cryptographer requires a
114 // passphrase for its first attempt at
115 // encryption.
Nicolas Zea 2011/04/29 22:59:30 Mention that this is the migration/upgrade case, a
Raghu Simha 2011/04/30 00:43:06 Done.
116 REASON_DECRYPTION = 2, // The cryptographer requires a
117 // passphrase for its first attempt at
118 // decryption.
119 REASON_SET_PASSPHRASE_FAILED = 3, // The cryptographer requires a new
120 // passphrase because its attempt at
121 // decryption with the cached passphrase
122 // was unsuccessful.
123 };
124
125 // Returns the string representation of a PassphraseRequiredReason value.
126 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason);
127
110 // A UserShare encapsulates the syncable pieces that represent an authenticated 128 // A UserShare encapsulates the syncable pieces that represent an authenticated
111 // user and their data (share). 129 // user and their data (share).
112 // This encompasses all pieces required to build transaction objects on the 130 // This encompasses all pieces required to build transaction objects on the
113 // syncable share. 131 // syncable share.
114 struct UserShare { 132 struct UserShare {
115 UserShare(); 133 UserShare();
116 ~UserShare(); 134 ~UserShare();
117 135
118 // The DirectoryManager itself, which is the parent of Transactions and can 136 // The DirectoryManager itself, which is the parent of Transactions and can
119 // be shared across multiple threads (unlike Directory). 137 // be shared across multiple threads (unlike Directory).
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 virtual void OnSyncCycleCompleted( 790 virtual void OnSyncCycleCompleted(
773 const browser_sync::sessions::SyncSessionSnapshot* snapshot) = 0; 791 const browser_sync::sessions::SyncSessionSnapshot* snapshot) = 0;
774 792
775 // Called when user interaction may be required due to an auth problem. 793 // Called when user interaction may be required due to an auth problem.
776 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) = 0; 794 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) = 0;
777 795
778 // Called when a new auth token is provided by the sync server. 796 // Called when a new auth token is provided by the sync server.
779 virtual void OnUpdatedToken(const std::string& token) = 0; 797 virtual void OnUpdatedToken(const std::string& token) = 0;
780 798
781 // Called when user interaction is required to obtain a valid passphrase. 799 // Called when user interaction is required to obtain a valid passphrase.
782 // If the passphrase is required to decrypt something that has 800 // - If the passphrase is required for encryption, |reason| is
783 // already been encrypted (and thus has to match the existing key), 801 // REASON_ENCRYPTION.
784 // |for_decryption| will be true. If the passphrase is needed for 802 // - If the passphrase is required for the decryption of data that has
785 // encryption, |for_decryption| will be false. 803 // already been encrypted, |reason| will be REASON_DECRYPTION.
786 virtual void OnPassphraseRequired(bool for_decryption) = 0; 804 // - If the passphrase is required because decryption failed, and a new
787 805 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED.
788 // Called only by SyncInternal::SetPassphrase to indiciate that an attempted 806 virtual void OnPassphraseRequired(PassphraseRequiredReason reason) = 0;
789 // passphrase failed to decrypt pending keys. This is different from
790 // OnPassphraseRequired in that it denotes we finished an attempt to set
791 // a passphrase. OnPassphraseRequired means we have data we could not
792 // decrypt yet, and can come from numerous places.
793 virtual void OnPassphraseFailed() = 0;
794 807
795 // Called when the passphrase provided by the user has been accepted and is 808 // Called when the passphrase provided by the user has been accepted and is
796 // now used to encrypt sync data. |bootstrap_token| is an opaque base64 809 // now used to encrypt sync data. |bootstrap_token| is an opaque base64
797 // encoded representation of the key generated by the accepted passphrase, 810 // encoded representation of the key generated by the accepted passphrase,
798 // and is provided to the observer for persistence purposes and use in a 811 // and is provided to the observer for persistence purposes and use in a
799 // future initialization of sync (e.g. after restart). 812 // future initialization of sync (e.g. after restart).
800 virtual void OnPassphraseAccepted(const std::string& bootstrap_token) = 0; 813 virtual void OnPassphraseAccepted(const std::string& bootstrap_token) = 0;
801 814
802 // Called when initialization is complete to the point that SyncManager can 815 // Called when initialization is complete to the point that SyncManager can
803 // process changes. This does not necessarily mean authentication succeeded 816 // process changes. This does not necessarily mean authentication succeeded
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 private: 1021 private:
1009 // An opaque pointer to the nested private class. 1022 // An opaque pointer to the nested private class.
1010 SyncInternal* data_; 1023 SyncInternal* data_;
1011 1024
1012 DISALLOW_COPY_AND_ASSIGN(SyncManager); 1025 DISALLOW_COPY_AND_ASSIGN(SyncManager);
1013 }; 1026 };
1014 1027
1015 } // namespace sync_api 1028 } // namespace sync_api
1016 1029
1017 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ 1030 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698