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 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/location.h" | |
9 #include "base/task_runner.h" | |
10 #include "chromeos/login/auth/user_context.h" | |
11 | |
12 namespace chromeos { | |
13 | |
14 namespace { | |
15 | |
16 // The number of minutes that the user context will be stored. | |
17 const int64 kUserContextTimeToLiveMin = 10; | |
tbarzic
2014/10/27 21:44:43
Do you mean Max?
Tim Song
2014/10/31 17:57:37
This should say kUserContextTimeToLiveMinutes.
| |
18 | |
19 } // namespace | |
20 | |
21 ShortLivedUserContext::ShortLivedUserContext(const UserContext& user_context, | |
22 base::TaskRunner* task_runner) | |
23 : user_context_(new UserContext(user_context)), weak_ptr_factory_(this) { | |
24 task_runner->PostDelayedTask( | |
25 FROM_HERE, | |
26 base::Bind(&ShortLivedUserContext::DeleteUserContext, | |
27 weak_ptr_factory_.GetWeakPtr()), | |
28 base::TimeDelta::FromMinutes(kUserContextTimeToLiveMin)); | |
tbarzic
2014/10/27 21:44:43
What if the setup exceeds 10 min? Does setup fail
Tim Song
2014/10/31 17:57:37
The UI decision was to show the reauth before the
tbarzic
2014/10/31 18:24:08
Yeah, I was thinking that we may show an error mes
Tim Song
2014/11/01 03:16:52
I can add a check in the app to close the window i
| |
29 } | |
30 | |
31 ShortLivedUserContext::~ShortLivedUserContext() { | |
32 } | |
33 | |
34 void ShortLivedUserContext::DeleteUserContext() { | |
35 if (user_context_.get()) { | |
36 user_context_->ClearSecrets(); | |
37 user_context_.reset(); | |
38 } | |
39 } | |
40 | |
41 } // namespace chromeos | |
OLD | NEW |