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

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: Fix destruction order in tests on ChromeOS Created 5 years, 4 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/chrome_proximity_auth_client.h ('k') | components/components_tests.gyp » ('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 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 "chrome/browser/signin/chrome_proximity_auth_client.h" 5 #include "chrome/browser/signin/chrome_proximity_auth_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/profiles/profile_window.h" 9 #include "chrome/browser/profiles/profile_window.h"
10 #include "chrome/browser/signin/easy_unlock_service.h" 10 #include "chrome/browser/signin/easy_unlock_service.h"
11 #include "chrome/browser/signin/signin_manager_factory.h" 11 #include "chrome/browser/signin/signin_manager_factory.h"
12 #include "components/signin/core/browser/signin_manager_base.h" 12 #include "components/signin/core/browser/signin_manager_base.h"
13 13
14 using proximity_auth::ScreenlockState;
15
14 ChromeProximityAuthClient::ChromeProximityAuthClient(Profile* profile) 16 ChromeProximityAuthClient::ChromeProximityAuthClient(Profile* profile)
15 : profile_(profile) { 17 : profile_(profile) {
16 } 18 }
17 19
18 ChromeProximityAuthClient::~ChromeProximityAuthClient() { 20 ChromeProximityAuthClient::~ChromeProximityAuthClient() {
19 } 21 }
20 22
21 std::string ChromeProximityAuthClient::GetAuthenticatedUsername() const { 23 std::string ChromeProximityAuthClient::GetAuthenticatedUsername() const {
22 const SigninManagerBase* signin_manager = 24 const SigninManagerBase* signin_manager =
23 SigninManagerFactory::GetForProfileIfExists(profile_); 25 SigninManagerFactory::GetForProfileIfExists(profile_);
24 // |profile_| has to be a signed-in profile with SigninManager already 26 // |profile_| has to be a signed-in profile with SigninManager already
25 // created. Otherwise, just crash to collect stack. 27 // created. Otherwise, just crash to collect stack.
26 DCHECK(signin_manager); 28 DCHECK(signin_manager);
27 return signin_manager->GetAuthenticatedUsername(); 29 return signin_manager->GetAuthenticatedUsername();
28 } 30 }
29 31
32 void ChromeProximityAuthClient::UpdateScreenlockState(ScreenlockState state) {
33 EasyUnlockService* service = EasyUnlockService::Get(profile_);
34 if (service)
35 service->UpdateScreenlockState(state);
36 }
37
30 void ChromeProximityAuthClient::FinalizeUnlock(bool success) { 38 void ChromeProximityAuthClient::FinalizeUnlock(bool success) {
31 EasyUnlockService::Get(profile_)->FinalizeUnlock(success); 39 EasyUnlockService* service = EasyUnlockService::Get(profile_);
40 if (service)
41 service->FinalizeUnlock(success);
32 } 42 }
43
44 void ChromeProximityAuthClient::FinalizeSignin(const std::string& secret) {
45 EasyUnlockService* service = EasyUnlockService::Get(profile_);
46 if (service)
47 service->FinalizeSignin(secret);
48 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_proximity_auth_client.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698