OLD | NEW |
(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_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 |
| 11 namespace base { |
| 12 class TaskRunner; |
| 13 } |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 class UserContext; |
| 18 |
| 19 // Stores the UserContext of an authentication operation on the sign-in/lock |
| 20 // screen, which is used to generate the keys for Easy Sign-in. Because the |
| 21 // UserContext stores the key to login, this class will schedule it to be |
| 22 // deleted after a set period of time for security. |
| 23 class ShortLivedUserContext { |
| 24 public: |
| 25 ShortLivedUserContext(const UserContext& user_context, |
| 26 base::TaskRunner* task_runner); |
| 27 virtual ~ShortLivedUserContext(); |
| 28 |
| 29 // The UserContext returned here can be NULL if its time-to-live has expired. |
| 30 UserContext* user_context() { return user_context_.get(); } |
| 31 |
| 32 private: |
| 33 void DeleteUserContext(); |
| 34 |
| 35 scoped_ptr<UserContext> user_context_; |
| 36 |
| 37 base::WeakPtrFactory<ShortLivedUserContext> weak_ptr_factory_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(ShortLivedUserContext); |
| 40 }; |
| 41 |
| 42 } // namespace chromeos |
| 43 |
| 44 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |
OLD | NEW |