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

Unified Diff: remoting/ios/facade/ios_client_runtime_delegate.mm

Issue 2949713002: [CRD iOS] Refactor an interface for RemotingAuthorization (Closed)
Patch Set: Resolve feedback Created 3 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: remoting/ios/facade/ios_client_runtime_delegate.mm
diff --git a/remoting/ios/facade/ios_client_runtime_delegate.mm b/remoting/ios/facade/ios_client_runtime_delegate.mm
index ebb3c798b4cff5ba84f2a44ef30195e0045c76ac..8fc5301e0d3fd82bd9d7296cb9fa026880234c84 100644
--- a/remoting/ios/facade/ios_client_runtime_delegate.mm
+++ b/remoting/ios/facade/ios_client_runtime_delegate.mm
@@ -17,6 +17,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
+#include "base/strings/sys_string_conversions.h"
namespace remoting {
@@ -44,14 +45,13 @@ void IosClientRuntimeDelegate::RequestAuthTokenForLogger() {
base::Unretained(this)));
return;
}
- if ([[RemotingService SharedInstance].authentication.user isAuthenticated]) {
- [[RemotingService SharedInstance].authentication
- callbackWithAccessToken:base::BindBlockArc(^(
- remoting::OAuthTokenGetter::Status status,
- const std::string& user_email,
- const std::string& access_token) {
- if (status == remoting::OAuthTokenGetter::Status::SUCCESS) {
+ if ([RemotingService.instance.authentication.user isAuthenticated]) {
+ [RemotingService.instance.authentication
+ callbackWithAccessToken:^(RemotingAuthenticationStatus status,
+ NSString* userEmail, NSString* accessToken) {
+ if (status == RemotingAuthenticationStatusSuccess) {
// Set the new auth token for the log writer on the network thread.
+ std::string access_token = base::SysNSStringToUTF8(accessToken);
runtime_->network_task_runner()->PostTask(
FROM_HERE, base::BindBlockArc(^{
runtime_->log_writer()->SetAuthToken(access_token);
@@ -60,7 +60,7 @@ void IosClientRuntimeDelegate::RequestAuthTokenForLogger() {
LOG(ERROR) << "Failed to fetch access token for log writer. ("
<< status << ")";
}
- })];
+ }];
}
}

Powered by Google App Engine
This is Rietveld 408576698