Chromium Code Reviews| Index: chrome/browser/signin/chrome_proximity_auth_client.cc |
| diff --git a/chrome/browser/signin/chrome_proximity_auth_client.cc b/chrome/browser/signin/chrome_proximity_auth_client.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d6f7c511f635a8f4ab2576c6aab2a3be1605ccfe |
| --- /dev/null |
| +++ b/chrome/browser/signin/chrome_proximity_auth_client.cc |
| @@ -0,0 +1,30 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/logging.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/profiles/profile_window.h" |
| +#include "chrome/browser/signin/chrome_proximity_auth_client.h" |
| +#include "chrome/browser/signin/signin_manager_factory.h" |
| +#include "components/signin/core/browser/signin_manager_base.h" |
| + |
| +ChromeProximityAuthClient::ChromeProximityAuthClient(Profile* profile) |
| + : profile_(profile) { |
| +} |
| + |
| +ChromeProximityAuthClient::~ChromeProximityAuthClient() { |
| +} |
| + |
| +std::string ChromeProximityAuthClient::GetAuthenticatedUsername() const { |
| + const SigninManagerBase* signin_manager = |
| + SigninManagerFactory::GetForProfileIfExists(profile_); |
| + // |profile_| has to be a signed-in profile with SigninManager already |
| + // created. Otherwise, just crash to collect stack. |
| + DCHECK(signin_manager); |
| + return signin_manager->GetAuthenticatedUsername(); |
|
Mike Lerman
2015/06/26 13:09:51
Please use GetAuthenticatedAccountId() to uniquely
Ilya Sherman
2015/06/27 08:18:00
Hmm, I'm hesitant to change this, as there seems t
|
| +} |
| + |
| +void ChromeProximityAuthClient::Lock() { |
| + profiles::LockProfile(profile_); |
|
Mike Lerman
2015/06/26 13:09:51
Before calling Lock(), perhaps DCHECK IsProfileLoc
Ilya Sherman
2015/06/27 08:18:00
Acknowledged.
|
| +} |