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

Side by Side 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: fixes + git cl format Created 6 years, 1 month 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_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 "apps/app_lifetime_monitor.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11
12 namespace base {
13 class TaskRunner;
14 }
15
16 namespace chromeos {
17
18 class UserContext;
19
20 // Stores the UserContext of an authentication operation on the sign-in/lock
21 // screen, which is used to generate the keys for Easy Sign-in.
22 // The lifetime of the user context is bound the the setup app window. As a
23 // fail-safe, the user context will also be deleted after a set period of time
24 // in case the app is left open indefintely.
25 class ShortLivedUserContext : public apps::AppLifetimeMonitor::Observer {
26 public:
27 ShortLivedUserContext(const UserContext& user_context,
28 apps::AppLifetimeMonitor* app_lifetime_monitor,
29 base::TaskRunner* task_runner);
30 virtual ~ShortLivedUserContext();
31
32 // The UserContext returned here can be NULL if its time-to-live has expired.
33 UserContext* user_context() { return user_context_.get(); }
34
35 private:
36 void Reset();
37
38 // apps::AppLifetimeMonitor::Observer:
39 virtual void OnAppDeactivated(Profile* profile,
40 const std::string& app_id) override;
41
42 scoped_ptr<UserContext> user_context_;
43
44 apps::AppLifetimeMonitor* app_lifetime_monitor_;
45
46 base::WeakPtrFactory<ShortLivedUserContext> weak_ptr_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(ShortLivedUserContext);
49 };
50
51 } // namespace chromeos
52
53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_SHORT_LIVED_USER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698