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

Unified Diff: ios/chrome/browser/ui/payments/payment_request_mediator.mm

Issue 2866793002: [Payment Request] Refactors PaymentRequestCoordinator. (Closed)
Patch Set: Reformats selector. Created 3 years, 7 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: ios/chrome/browser/ui/payments/payment_request_mediator.mm
diff --git a/ios/chrome/browser/ui/payments/payment_request_mediator.mm b/ios/chrome/browser/ui/payments/payment_request_mediator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ce5c2d6fd30f569ba4b8e7ca92e5fa257fad9368
--- /dev/null
+++ b/ios/chrome/browser/ui/payments/payment_request_mediator.mm
@@ -0,0 +1,34 @@
+// Copyright 2017 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 "ios/chrome/browser/ui/payments/payment_request_mediator.h"
+
+#include "base/strings/sys_string_conversions.h"
+#include "components/signin/core/browser/signin_manager.h"
+#include "ios/chrome/browser/signin/signin_manager_factory.h"
+
+@implementation PaymentRequestMediator {
+ ios::ChromeBrowserState* _browserState;
+}
+
+- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState {
+ DCHECK(browserState);
+ self = [super init];
+ if (self) {
+ _browserState = browserState;
+ }
+ return self;
+}
+
+- (NSString*)authenticatedAccountName {
+ const SigninManager* signinManager =
+ ios::SigninManagerFactory::GetForBrowserStateIfExists(_browserState);
+ if (signinManager && signinManager->IsAuthenticated()) {
+ return base::SysUTF8ToNSString(
+ signinManager->GetAuthenticatedAccountInfo().email);
+ }
+ return nil;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698