Index: chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h |
diff --git a/chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h b/chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b140b910e02ad9798b7bea60bf156c579036a8f2 |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |
+#define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+ |
+namespace base { |
+class TaskRunner; |
+} |
+ |
+namespace chromeos { |
+ |
+class UserContext; |
+ |
+// Stores the UserContext of an authentication operation on the sign-in/lock |
+// screen, which is used to generate the keys for Easy Sign-in. Because the |
+// UserContext stores the key to login, this class will schedule it to be |
+// deleted after a set period of time for security. |
+class ShortLivedUserContext { |
+ public: |
+ ShortLivedUserContext(const UserContext& user_context, |
+ base::TaskRunner* task_runner); |
+ virtual ~ShortLivedUserContext(); |
+ |
+ // The UserContext returned here can be NULL if its time-to-live has expired. |
+ UserContext* user_context() { return user_context_.get(); } |
+ |
+ private: |
+ void DeleteUserContext(); |
+ |
+ scoped_ptr<UserContext> user_context_; |
+ |
+ base::WeakPtrFactory<ShortLivedUserContext> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ShortLivedUserContext); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_ |