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

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

Issue 1372283002: Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 2 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_auth_attempt.h" 5 #include "chrome/browser/signin/easy_unlock_auth_attempt.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/signin/easy_unlock_app_manager.h" 10 #include "chrome/browser/signin/easy_unlock_app_manager.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType( 111 proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType(
112 user_id_); 112 user_id_);
113 113
114 if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { 114 if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) {
115 Cancel(user_id_); 115 Cancel(user_id_);
116 return false; 116 return false;
117 } 117 }
118 118
119 state_ = STATE_RUNNING; 119 state_ = STATE_RUNNING;
120 120
121 // We need this workaround for ProximityAuthBleSystem, which is already
122 // notified in EasyUnlockService. No notification is sent when only the
123 // |kEnableBluetoothLowEnergyDiscovery| flag is set, and
124 // |app_manager_->SendAuthAttemptEvent()| returns false. As a result, the auth
125 // attempt will always fail.
126 // TODO(sacomoto): Remove this when it's not needed anymore.
127 if (!app_manager_->SendAuthAttemptEvent() &&
128 !base::CommandLine::ForCurrentProcess()->HasSwitch(
129 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) {
130 Cancel(user_id_);
131 return false;
132 }
133
134 return true; 121 return true;
135 } 122 }
136 123
137 void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id, 124 void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id,
138 bool success) { 125 bool success) {
139 if (state_ != STATE_RUNNING || user_id != user_id_) 126 if (state_ != STATE_RUNNING || user_id != user_id_)
140 return; 127 return;
141 128
142 if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) 129 if (!proximity_auth::ScreenlockBridge::Get()->IsLocked())
143 return; 130 return;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 state_ = STATE_DONE; 171 state_ = STATE_DONE;
185 } 172 }
186 173
187 void EasyUnlockAuthAttempt::Cancel(const std::string& user_id) { 174 void EasyUnlockAuthAttempt::Cancel(const std::string& user_id) {
188 state_ = STATE_DONE; 175 state_ = STATE_DONE;
189 176
190 const bool kFailure = false; 177 const bool kFailure = false;
191 finalized_callback_.Run(type_, kFailure, user_id, std::string(), 178 finalized_callback_.Run(type_, kFailure, user_id, std::string(),
192 std::string()); 179 std::string());
193 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698