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

Unified Diff: chrome/browser/signin/chrome_proximity_auth_client.cc

Issue 1209193003: [Proximity Auth] Create one ProximityAuthClient per profile, rather than one global one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
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.
+}

Powered by Google App Engine
This is Rietveld 408576698