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

Side by Side Diff: chrome/browser/chromeos/login/screen_locker.cc

Issue 168623003: Add chrome.screenlockPrivate API functions to handle alternate auth types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/screen_locker.h" 5 #include "chrome/browser/chromeos/login/screen_locker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 void ScreenLocker::Authenticate(const UserContext& user_context) { 257 void ScreenLocker::Authenticate(const UserContext& user_context) {
258 LOG_ASSERT(IsUserLoggedIn(user_context.username)) 258 LOG_ASSERT(IsUserLoggedIn(user_context.username))
259 << "Invalid user trying to unlock."; 259 << "Invalid user trying to unlock.";
260 260
261 authentication_start_time_ = base::Time::Now(); 261 authentication_start_time_ = base::Time::Now();
262 delegate_->SetInputEnabled(false); 262 delegate_->SetInputEnabled(false);
263 delegate_->OnAuthenticate(); 263 delegate_->OnAuthenticate();
264 264
265 // Send authentication request to app using chrome.screenlockPrivate API 265 // Send authentication request to chrome.screenlockPrivate API event router
266 // if the authentication type is not the system password. 266 // if the authentication type is not the system password.
267 LoginDisplay::AuthType auth_type = GetAuthType(user_context.username); 267 LoginDisplay::AuthType auth_type = GetAuthType(user_context.username);
268 if (auth_type != LoginDisplay::OFFLINE_PASSWORD) { 268 if (auth_type != LoginDisplay::OFFLINE_PASSWORD) {
269 // Find the user that is authenticating.
270 const User* unlock_user = NULL; 269 const User* unlock_user = NULL;
271 for (UserList::const_iterator it = users_.begin(); 270 for (UserList::const_iterator it = users_.begin();
272 it != users_.end(); 271 it != users_.end();
273 ++it) { 272 ++it) {
274 if ((*it)->email() == user_context.username) { 273 if ((*it)->email() == user_context.username) {
275 unlock_user = *it; 274 unlock_user = *it;
276 break; 275 break;
277 } 276 }
278 } 277 }
279 LOG_ASSERT(unlock_user); 278 LOG_ASSERT(unlock_user);
280 279
281 // TODO(tengs): dispatch auth attempted event to the screenlockPrivate 280 Profile* profile = UserManager::Get()->GetProfileByUser(unlock_user);
282 // API's event router. 281 extensions::ScreenlockPrivateEventRouter* router =
282 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()
283 ->GetForProfile(profile);
284 router->OnAuthAttempted(auth_type, user_context.password);
283 return; 285 return;
284 } 286 }
285 287
286 BrowserThread::PostTask( 288 BrowserThread::PostTask(
287 BrowserThread::UI, FROM_HERE, 289 BrowserThread::UI, FROM_HERE,
288 base::Bind(&Authenticator::AuthenticateToUnlock, 290 base::Bind(&Authenticator::AuthenticateToUnlock,
289 authenticator_.get(), 291 authenticator_.get(),
290 user_context)); 292 user_context));
291 } 293 }
292 294
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 525
524 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { 526 bool ScreenLocker::IsUserLoggedIn(const std::string& username) {
525 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { 527 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) {
526 if ((*it)->email() == username) 528 if ((*it)->email() == username)
527 return true; 529 return true;
528 } 530 }
529 return false; 531 return false;
530 } 532 }
531 533
532 } // namespace chromeos 534 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698