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

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

Issue 1239193005: [Proximity Auth] Port the UnlockManager class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/profiles/profile_window.h" 7 #include "chrome/browser/profiles/profile_window.h"
8 #include "chrome/browser/signin/chrome_proximity_auth_client.h" 8 #include "chrome/browser/signin/chrome_proximity_auth_client.h"
9 #include "chrome/browser/signin/easy_unlock_service.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "components/signin/core/browser/signin_manager_base.h" 11 #include "components/signin/core/browser/signin_manager_base.h"
11 12
13 using proximity_auth::ScreenlockState;
14
12 ChromeProximityAuthClient::ChromeProximityAuthClient(Profile* profile) 15 ChromeProximityAuthClient::ChromeProximityAuthClient(Profile* profile)
13 : profile_(profile) { 16 : profile_(profile) {
14 } 17 }
15 18
16 ChromeProximityAuthClient::~ChromeProximityAuthClient() { 19 ChromeProximityAuthClient::~ChromeProximityAuthClient() {
17 } 20 }
18 21
19 std::string ChromeProximityAuthClient::GetAuthenticatedUsername() const { 22 std::string ChromeProximityAuthClient::GetAuthenticatedUsername() const {
20 const SigninManagerBase* signin_manager = 23 const SigninManagerBase* signin_manager =
21 SigninManagerFactory::GetForProfileIfExists(profile_); 24 SigninManagerFactory::GetForProfileIfExists(profile_);
22 // |profile_| has to be a signed-in profile with SigninManager already 25 // |profile_| has to be a signed-in profile with SigninManager already
23 // created. Otherwise, just crash to collect stack. 26 // created. Otherwise, just crash to collect stack.
24 DCHECK(signin_manager); 27 DCHECK(signin_manager);
25 return signin_manager->GetAuthenticatedUsername(); 28 return signin_manager->GetAuthenticatedUsername();
26 } 29 }
30
31 void ChromeProximityAuthClient::UpdateScreenlockState(ScreenlockState state) {
32 EasyUnlockService* service = EasyUnlockService::Get(profile_);
33 if (service)
34 service->UpdateScreenlockState(state);
35 }
36
37 void ChromeProximityAuthClient::FinalizeUnlock(bool success) {
38 EasyUnlockService* service = EasyUnlockService::Get(profile_);
39 if (service)
40 service->FinalizeUnlock(success);
41 }
42
43 void ChromeProximityAuthClient::FinalizeSignin(const std::string& secret) {
44 EasyUnlockService* service = EasyUnlockService::Get(profile_);
45 if (service)
46 service->FinalizeSignin(secret);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698