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

Side by Side Diff: chrome/browser/signin/easy_unlock_auth_attempt.h

Issue 585213002: [Easy signin] Wire up userClick auth attempt to easy unlock app and back (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@easy_signin_focused_user_changed_observer
Patch Set: fix screenlock private test Created 6 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_AUTH_ATTEMPT_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_AUTH_ATTEMPT_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11
12 class Profile;
13
14 // Class responsible for handling easy unlock auth attempts (both for unlocking
15 // the screen and logging in). The auth protocol is started by calling |Start|,
16 // which notifies the easy unlock app about auth attempt. When the auth result
17 // is available, |FinalizeUnlock| or |FinalizeSignin| should be called,
18 // depending on auth type.
19 // To cancel the in progress auth attempt, delete the |EasyUnlockAuthAttempt|
20 // object.
21 class EasyUnlockAuthAttempt {
22 public:
23 // The auth type.
24 enum Type {
25 TYPE_UNLOCK,
26 TYPE_SIGNIN
27 };
28
29 EasyUnlockAuthAttempt(Profile* profile,
30 const std::string& user_id,
31 Type type);
32 ~EasyUnlockAuthAttempt();
33
34 // Starts the auth attempt by sending screenlockPrivate.onAuthAttempted event
35 // to easy unlock app. Returns whether the event was successfully dispatched.
36 bool Start(const std::string& user_id);
37
38 // Finalizes an unlock attempt. It unlocks the screen if |success| is true.
39 // If |this| has TYPE_SIGNIN type, calling this method will cause signin
40 // failure equivalent to cancelling the attempt.
41 void FinalizeUnlock(const std::string& user_id, bool success);
42
43 // Finalizes signin attempt. It tries to log in using the secret derived from
44 // |wrapped_secret| decrypted by |session_key|. If the decryption fails, it
45 // fails the signin attempt.
46 // If called on an object with TYPE_UNLOCK type, it will cause unlock failure
47 // equivalent to cancelling the request.
48 void FinalizeSignin(const std::string& user_id,
49 const std::string& wrapped_secret,
50 const std::string& session_key);
51
52 private:
53 // The internal attempt state.
54 enum State {
55 STATE_IDLE,
56 STATE_RUNNING,
57 STATE_DONE
58 };
59
60 // Cancels the attempt.
61 void Cancel(const std::string& user_id);
62
63 Profile* profile_;
64 State state_;
65 std::string user_id_;
66 Type type_;
67
68 DISALLOW_COPY_AND_ASSIGN(EasyUnlockAuthAttempt);
69 };
70
71 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_AUTH_ATTEMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698