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

Unified Diff: chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h

Issue 668213003: Reauthenticate the user before launching Smart Lock setup app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change dcheck to log 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 side-by-side diff with in-line comments
Download patch
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..cc3f206ed4e1117f39407de85be79f0d4008c64a
--- /dev/null
+++ b/chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h
@@ -0,0 +1,52 @@
+// 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 "apps/app_lifetime_monitor.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.
+// The lifetime of the user context is bound the the setup app window. As a
+// fail-safe, the user context will also be deleted after a set period of time
+// in case the app is left open indefintely.
+class ShortLivedUserContext : public apps::AppLifetimeMonitor::Observer {
+ public:
+ ShortLivedUserContext(const UserContext& user_context,
+ apps::AppLifetimeMonitor* app_lifetime_monitor,
+ 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();
+
+ // apps::AppLifetimeMonitor::Observer:
+ virtual void OnAppDeactivated(Profile* profile, const std::string& app_id);
+
+ scoped_ptr<UserContext> user_context_;
+
+ apps::AppLifetimeMonitor* app_lifetime_monitor_;
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698