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

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

Issue 2937553002: Create Mojo Struct for user information used in login/lock screen. (Closed)
Patch Set: rebase Created 3 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 "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 state_ = new_state; 146 state_ = new_state;
147 147
148 // If lock screen is not active or it forces offline password, just cache the 148 // If lock screen is not active or it forces offline password, just cache the
149 // current state. The screenlock state will get refreshed in |ScreenDidLock|. 149 // current state. The screenlock state will get refreshed in |ScreenDidLock|.
150 if (!screenlock_bridge_->IsLocked()) 150 if (!screenlock_bridge_->IsLocked())
151 return; 151 return;
152 152
153 // Do nothing when auth type is online. 153 // Do nothing when auth type is online.
154 if (screenlock_bridge_->lock_handler()->GetAuthType(account_id_) == 154 if (screenlock_bridge_->lock_handler()->GetAuthType(account_id_) ==
155 proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) { 155 proximity_auth::mojom::AuthType::ONLINE_SIGN_IN) {
156 return; 156 return;
157 } 157 }
158 158
159 if (IsLockedState(state_)) 159 if (IsLockedState(state_))
160 did_see_locked_phone_ = true; 160 did_see_locked_phone_ = true;
161 161
162 // No hardlock UI for trial run. 162 // No hardlock UI for trial run.
163 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { 163 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) {
164 ShowHardlockUI(); 164 ShowHardlockUI();
165 return; 165 return;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 ChangeState(last_state); 264 ChangeState(last_state);
265 } 265 }
266 266
267 void EasyUnlockScreenlockStateHandler::ShowHardlockUI() { 267 void EasyUnlockScreenlockStateHandler::ShowHardlockUI() {
268 DCHECK(hardlock_state_ != NO_HARDLOCK); 268 DCHECK(hardlock_state_ != NO_HARDLOCK);
269 269
270 if (!screenlock_bridge_->IsLocked()) 270 if (!screenlock_bridge_->IsLocked())
271 return; 271 return;
272 272
273 // Do not override online signin. 273 // Do not override online signin.
274 const proximity_auth::ScreenlockBridge::LockHandler::AuthType 274 const proximity_auth::mojom::AuthType existing_auth_type =
275 existing_auth_type = 275 screenlock_bridge_->lock_handler()->GetAuthType(account_id_);
276 screenlock_bridge_->lock_handler()->GetAuthType(account_id_); 276 if (existing_auth_type == proximity_auth::mojom::AuthType::ONLINE_SIGN_IN)
277 if (existing_auth_type ==
278 proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN)
279 return; 277 return;
280 278
281 if (existing_auth_type != 279 if (existing_auth_type != proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) {
282 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) {
283 screenlock_bridge_->lock_handler()->SetAuthType( 280 screenlock_bridge_->lock_handler()->SetAuthType(
284 account_id_, 281 account_id_, proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
285 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD,
286 base::string16()); 282 base::string16());
287 } 283 }
288 284
289 if (hardlock_state_ == NO_PAIRING) { 285 if (hardlock_state_ == NO_PAIRING) {
290 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(account_id_); 286 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(account_id_);
291 hardlock_ui_shown_ = false; 287 hardlock_ui_shown_ = false;
292 return; 288 return;
293 } 289 }
294 290
295 if (hardlock_ui_shown_) 291 if (hardlock_ui_shown_)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // TODO(tbarzic): Figure out the name for non Chrome OS case. 366 // TODO(tbarzic): Figure out the name for non Chrome OS case.
371 return base::ASCIIToUTF16("Chrome"); 367 return base::ASCIIToUTF16("Chrome");
372 #endif 368 #endif
373 } 369 }
374 370
375 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { 371 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() {
376 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) 372 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK)
377 return; 373 return;
378 374
379 // Do not override online signin. 375 // Do not override online signin.
380 const proximity_auth::ScreenlockBridge::LockHandler::AuthType 376 const proximity_auth::mojom::AuthType existing_auth_type =
381 existing_auth_type = 377 screenlock_bridge_->lock_handler()->GetAuthType(account_id_);
382 screenlock_bridge_->lock_handler()->GetAuthType(account_id_); 378 DCHECK_NE(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN,
383 DCHECK_NE(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN,
384 existing_auth_type); 379 existing_auth_type);
385 380
386 if (state_ == ScreenlockState::AUTHENTICATED) { 381 if (state_ == ScreenlockState::AUTHENTICATED) {
387 if (existing_auth_type != 382 if (existing_auth_type != proximity_auth::mojom::AuthType::USER_CLICK) {
388 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) {
389 screenlock_bridge_->lock_handler()->SetAuthType( 383 screenlock_bridge_->lock_handler()->SetAuthType(
390 account_id_, 384 account_id_, proximity_auth::mojom::AuthType::USER_CLICK,
391 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK,
392 l10n_util::GetStringUTF16( 385 l10n_util::GetStringUTF16(
393 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); 386 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE));
394 } 387 }
395 } else if (existing_auth_type != 388 } else if (existing_auth_type !=
396 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { 389 proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) {
397 screenlock_bridge_->lock_handler()->SetAuthType( 390 screenlock_bridge_->lock_handler()->SetAuthType(
398 account_id_, 391 account_id_, proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
399 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD,
400 base::string16()); 392 base::string16());
401 } 393 }
402 } 394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698