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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.cc

Issue 887093004: [Cleanup] Move the Easy Unlock metrics files out of the chromeos directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « chrome/browser/signin/easy_unlock_metrics.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h"
17 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 16 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
17 #include "chrome/browser/signin/easy_unlock_metrics.h"
18 #include "chromeos/login/auth/user_context.h" 18 #include "chromeos/login/auth/user_context.h"
19 #include "chromeos/tpm/tpm_token_loader.h" 19 #include "chromeos/tpm/tpm_token_loader.h"
20 20
21 namespace { 21 namespace {
22 22
23 // The maximum allowed backoff interval when waiting for cryptohome to start. 23 // The maximum allowed backoff interval when waiting for cryptohome to start.
24 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u; 24 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u;
25 25
26 // If the data load fails, the initial interval after which the load will be 26 // If the data load fails, the initial interval after which the load will be
27 // retried. Further intervals will exponentially increas by factor 2. 27 // retried. Further intervals will exponentially increas by factor 2.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (!data || data->devices.size() <= device_index) 167 if (!data || data->devices.size() <= device_index)
168 return std::string(); 168 return std::string();
169 return data->devices[device_index].wrapped_secret; 169 return data->devices[device_index].wrapped_secret;
170 } 170 }
171 171
172 void EasyUnlockServiceSignin::RecordEasySignInOutcome( 172 void EasyUnlockServiceSignin::RecordEasySignInOutcome(
173 const std::string& user_id, 173 const std::string& user_id,
174 bool success) const { 174 bool success) const {
175 DCHECK_EQ(GetUserEmail(), user_id); 175 DCHECK_EQ(GetUserEmail(), user_id);
176 176
177 chromeos::RecordEasyUnlockLoginEvent(success 177 RecordEasyUnlockLoginEvent(
178 ? chromeos::EASY_SIGN_IN_SUCCESS 178 success ? EASY_SIGN_IN_SUCCESS : EASY_SIGN_IN_FAILURE);
179 : chromeos::EASY_SIGN_IN_FAILURE);
180 DVLOG(1) << "Easy sign-in " << (success ? "success" : "failure"); 179 DVLOG(1) << "Easy sign-in " << (success ? "success" : "failure");
181 } 180 }
182 181
183 void EasyUnlockServiceSignin::RecordPasswordLoginEvent( 182 void EasyUnlockServiceSignin::RecordPasswordLoginEvent(
184 const std::string& user_id) const { 183 const std::string& user_id) const {
185 // This happens during tests where user could login without pod focusing. 184 // This happens during tests where user could login without pod focusing.
186 if (GetUserEmail() != user_id) 185 if (GetUserEmail() != user_id)
187 return; 186 return;
188 187
189 chromeos::EasyUnlockLoginEvent event = 188 EasyUnlockLoginEvent event = EASY_SIGN_IN_LOGIN_EVENT_COUNT;
190 chromeos::EASY_SIGN_IN_LOGIN_EVENT_COUNT;
191 if (!GetRemoteDevices() || 189 if (!GetRemoteDevices() ||
192 GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) { 190 GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) {
193 event = chromeos::PASSWORD_SIGN_IN_NO_PAIRING; 191 event = PASSWORD_SIGN_IN_NO_PAIRING;
194 } else if (GetHardlockState() != 192 } else if (GetHardlockState() !=
195 EasyUnlockScreenlockStateHandler::NO_HARDLOCK) { 193 EasyUnlockScreenlockStateHandler::NO_HARDLOCK) {
196 switch (GetHardlockState()) { 194 switch (GetHardlockState()) {
197 case EasyUnlockScreenlockStateHandler::NO_HARDLOCK: 195 case EasyUnlockScreenlockStateHandler::NO_HARDLOCK:
198 case EasyUnlockScreenlockStateHandler::NO_PAIRING: 196 case EasyUnlockScreenlockStateHandler::NO_PAIRING:
199 NOTREACHED(); 197 NOTREACHED();
200 break; 198 break;
201 case EasyUnlockScreenlockStateHandler::USER_HARDLOCK: 199 case EasyUnlockScreenlockStateHandler::USER_HARDLOCK:
202 event = chromeos::PASSWORD_SIGN_IN_USER_HARDLOCK; 200 event = PASSWORD_SIGN_IN_USER_HARDLOCK;
203 break; 201 break;
204 case EasyUnlockScreenlockStateHandler::PAIRING_CHANGED: 202 case EasyUnlockScreenlockStateHandler::PAIRING_CHANGED:
205 event = chromeos::PASSWORD_SIGN_IN_PAIRING_CHANGED; 203 event = PASSWORD_SIGN_IN_PAIRING_CHANGED;
206 break; 204 break;
207 case EasyUnlockScreenlockStateHandler::LOGIN_FAILED: 205 case EasyUnlockScreenlockStateHandler::LOGIN_FAILED:
208 event = chromeos::PASSWORD_SIGN_IN_LOGIN_FAILED; 206 event = PASSWORD_SIGN_IN_LOGIN_FAILED;
209 break; 207 break;
210 case EasyUnlockScreenlockStateHandler::PAIRING_ADDED: 208 case EasyUnlockScreenlockStateHandler::PAIRING_ADDED:
211 event = chromeos::PASSWORD_SIGN_IN_PAIRING_ADDED; 209 event = PASSWORD_SIGN_IN_PAIRING_ADDED;
212 break; 210 break;
213 } 211 }
214 } else if (!screenlock_state_handler()) { 212 } else if (!screenlock_state_handler()) {
215 event = chromeos::PASSWORD_SIGN_IN_NO_SCREENLOCK_STATE_HANDLER; 213 event = PASSWORD_SIGN_IN_NO_SCREENLOCK_STATE_HANDLER;
216 } else { 214 } else {
217 switch (screenlock_state_handler()->state()) { 215 switch (screenlock_state_handler()->state()) {
218 case EasyUnlockScreenlockStateHandler::STATE_INACTIVE: 216 case EasyUnlockScreenlockStateHandler::STATE_INACTIVE:
219 event = chromeos::PASSWORD_SIGN_IN_SERVICE_NOT_ACTIVE; 217 event = PASSWORD_SIGN_IN_SERVICE_NOT_ACTIVE;
220 break; 218 break;
221 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: 219 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH:
222 event = chromeos::PASSWORD_SIGN_IN_NO_BLUETOOTH; 220 event = PASSWORD_SIGN_IN_NO_BLUETOOTH;
223 break; 221 break;
224 case EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING: 222 case EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING:
225 event = chromeos::PASSWORD_SIGN_IN_BLUETOOTH_CONNECTING; 223 event = PASSWORD_SIGN_IN_BLUETOOTH_CONNECTING;
226 break; 224 break;
227 case EasyUnlockScreenlockStateHandler::STATE_NO_PHONE: 225 case EasyUnlockScreenlockStateHandler::STATE_NO_PHONE:
228 event = chromeos::PASSWORD_SIGN_IN_NO_PHONE; 226 event = PASSWORD_SIGN_IN_NO_PHONE;
229 break; 227 break;
230 case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED: 228 case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED:
231 event = chromeos::PASSWORD_SIGN_IN_PHONE_NOT_AUTHENTICATED; 229 event = PASSWORD_SIGN_IN_PHONE_NOT_AUTHENTICATED;
232 break; 230 break;
233 case EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED: 231 case EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED:
234 event = chromeos::PASSWORD_SIGN_IN_PHONE_LOCKED; 232 event = PASSWORD_SIGN_IN_PHONE_LOCKED;
235 break; 233 break;
236 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE: 234 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE:
237 event = chromeos::PASSWORD_SIGN_IN_PHONE_NOT_LOCKABLE; 235 event = PASSWORD_SIGN_IN_PHONE_NOT_LOCKABLE;
238 break; 236 break;
239 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED: 237 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED:
240 event = chromeos::PASSWORD_SIGN_IN_PHONE_UNSUPPORTED; 238 event = PASSWORD_SIGN_IN_PHONE_UNSUPPORTED;
241 break; 239 break;
242 case EasyUnlockScreenlockStateHandler::STATE_RSSI_TOO_LOW: 240 case EasyUnlockScreenlockStateHandler::STATE_RSSI_TOO_LOW:
243 event = chromeos::PASSWORD_SIGN_IN_RSSI_TOO_LOW; 241 event = PASSWORD_SIGN_IN_RSSI_TOO_LOW;
244 break; 242 break;
245 case EasyUnlockScreenlockStateHandler::STATE_TX_POWER_TOO_HIGH: 243 case EasyUnlockScreenlockStateHandler::STATE_TX_POWER_TOO_HIGH:
246 event = chromeos::PASSWORD_SIGN_IN_TX_POWER_TOO_HIGH; 244 event = PASSWORD_SIGN_IN_TX_POWER_TOO_HIGH;
247 break; 245 break;
248 case EasyUnlockScreenlockStateHandler:: 246 case EasyUnlockScreenlockStateHandler::
249 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH: 247 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH:
250 event = chromeos::PASSWORD_SIGN_IN_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH; 248 event = PASSWORD_SIGN_IN_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH;
251 break; 249 break;
252 case EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED: 250 case EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED:
253 event = chromeos::PASSWORD_SIGN_IN_WITH_AUTHENTICATED_PHONE; 251 event = PASSWORD_SIGN_IN_WITH_AUTHENTICATED_PHONE;
254 break; 252 break;
255 } 253 }
256 } 254 }
257 255
258 chromeos::RecordEasyUnlockLoginEvent(event); 256 RecordEasyUnlockLoginEvent(event);
259 DVLOG(1) << "EasySignIn password login event, event=" << event; 257 DVLOG(1) << "EasySignIn password login event, event=" << event;
260 } 258 }
261 259
262 void EasyUnlockServiceSignin::InitializeInternal() { 260 void EasyUnlockServiceSignin::InitializeInternal() {
263 if (chromeos::LoginState::Get()->IsUserLoggedIn()) 261 if (chromeos::LoginState::Get()->IsUserLoggedIn())
264 return; 262 return;
265 263
266 service_active_ = true; 264 service_active_ = true;
267 265
268 chromeos::LoginState::Get()->AddObserver(this); 266 chromeos::LoginState::Get()->AddObserver(this);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return NULL; 386 return NULL;
389 387
390 std::map<std::string, UserData*>::const_iterator it = 388 std::map<std::string, UserData*>::const_iterator it =
391 user_data_.find(user_id_); 389 user_data_.find(user_id_);
392 if (it == user_data_.end()) 390 if (it == user_data_.end())
393 return NULL; 391 return NULL;
394 if (it->second->state != USER_DATA_STATE_LOADED) 392 if (it->second->state != USER_DATA_STATE_LOADED)
395 return NULL; 393 return NULL;
396 return it->second; 394 return it->second;
397 } 395 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_metrics.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698