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

Side by Side Diff: chromeos/tpm/tpm_token_info_getter.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/tpm/tpm_token_info_getter.h" 5 #include "chromeos/tpm/tpm_token_info_getter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "chromeos/dbus/cryptohome_client.h" 9 #include "chromeos/dbus/cryptohome_client.h"
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 TPMTokenInfo::TPMTokenInfo() 35 TPMTokenInfo::TPMTokenInfo()
36 : tpm_is_enabled(false), 36 : tpm_is_enabled(false),
37 token_slot_id(-1) { 37 token_slot_id(-1) {
38 } 38 }
39 39
40 TPMTokenInfo::~TPMTokenInfo() {} 40 TPMTokenInfo::~TPMTokenInfo() {}
41 41
42 // static 42 // static
43 scoped_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForUserToken( 43 scoped_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForUserToken(
44 const std::string& user_id, 44 const user_manager::UserID& user_id,
45 CryptohomeClient* cryptohome_client, 45 CryptohomeClient* cryptohome_client,
46 const scoped_refptr<base::TaskRunner>& delayed_task_runner) { 46 const scoped_refptr<base::TaskRunner>& delayed_task_runner) {
47 CHECK(!user_id.empty()); 47 CHECK(!user_id.empty());
48 return scoped_ptr<TPMTokenInfoGetter>( 48 return scoped_ptr<TPMTokenInfoGetter>(
49 new TPMTokenInfoGetter( 49 new TPMTokenInfoGetter(
50 TYPE_USER, user_id, cryptohome_client, delayed_task_runner)); 50 TYPE_USER, user_id, cryptohome_client, delayed_task_runner));
51 } 51 }
52 52
53 // static 53 // static
54 scoped_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForSystemToken( 54 scoped_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForSystemToken(
55 CryptohomeClient* cryptohome_client, 55 CryptohomeClient* cryptohome_client,
56 const scoped_refptr<base::TaskRunner>& delayed_task_runner) { 56 const scoped_refptr<base::TaskRunner>& delayed_task_runner) {
57 return scoped_ptr<TPMTokenInfoGetter>( 57 return scoped_ptr<TPMTokenInfoGetter>(
58 new TPMTokenInfoGetter( 58 new TPMTokenInfoGetter(
59 TYPE_SYSTEM, std::string(), cryptohome_client, delayed_task_runner)); 59 TYPE_SYSTEM, user_manager::UserID(std::string(), std::string()), crypt ohome_client, delayed_task_runner));
60 } 60 }
61 61
62 TPMTokenInfoGetter::~TPMTokenInfoGetter() {} 62 TPMTokenInfoGetter::~TPMTokenInfoGetter() {}
63 63
64 void TPMTokenInfoGetter::Start(const TPMTokenInfoCallback& callback) { 64 void TPMTokenInfoGetter::Start(const TPMTokenInfoCallback& callback) {
65 CHECK(state_ == STATE_INITIAL); 65 CHECK(state_ == STATE_INITIAL);
66 CHECK(!callback.is_null()); 66 CHECK(!callback.is_null());
67 67
68 callback_ = callback; 68 callback_ = callback;
69 69
70 state_ = STATE_STARTED; 70 state_ = STATE_STARTED;
71 Continue(); 71 Continue();
72 } 72 }
73 73
74 TPMTokenInfoGetter::TPMTokenInfoGetter( 74 TPMTokenInfoGetter::TPMTokenInfoGetter(
75 TPMTokenInfoGetter::Type type, 75 TPMTokenInfoGetter::Type type,
76 const std::string& user_id, 76 const user_manager::UserID& user_id,
77 CryptohomeClient* cryptohome_client, 77 CryptohomeClient* cryptohome_client,
78 const scoped_refptr<base::TaskRunner>& delayed_task_runner) 78 const scoped_refptr<base::TaskRunner>& delayed_task_runner)
79 : delayed_task_runner_(delayed_task_runner), 79 : delayed_task_runner_(delayed_task_runner),
80 type_(type), 80 type_(type),
81 state_(TPMTokenInfoGetter::STATE_INITIAL), 81 state_(TPMTokenInfoGetter::STATE_INITIAL),
82 user_id_(user_id), 82 user_id_(user_id),
83 tpm_request_delay_( 83 tpm_request_delay_(
84 base::TimeDelta::FromMilliseconds(kInitialRequestDelayMs)), 84 base::TimeDelta::FromMilliseconds(kInitialRequestDelayMs)),
85 cryptohome_client_(cryptohome_client), 85 cryptohome_client_(cryptohome_client),
86 weak_factory_(this) { 86 weak_factory_(this) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 TPMTokenInfo token_info; 153 TPMTokenInfo token_info;
154 token_info.tpm_is_enabled = true; 154 token_info.tpm_is_enabled = true;
155 token_info.token_name = token_name; 155 token_info.token_name = token_name;
156 token_info.user_pin = user_pin; 156 token_info.user_pin = user_pin;
157 token_info.token_slot_id = token_slot_id; 157 token_info.token_slot_id = token_slot_id;
158 158
159 callback_.Run(token_info); 159 callback_.Run(token_info);
160 } 160 }
161 161
162 } // namespace chromeos 162 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698