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

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

Issue 2829673003: Adding a Client Runtime Delegate for iOS (Closed)
Patch Set: Moving removing_service change to gl related cl. Created 3 years, 8 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
« no previous file with comments | « remoting/client/ios/facade/ios_client_runtime_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/ios/facade/ios_client_runtime_delegate.mm
diff --git a/remoting/client/ios/facade/ios_client_runtime_delegate.mm b/remoting/client/ios/facade/ios_client_runtime_delegate.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8bd90fc070aaf9fe3609f16baf9c09999a776a25
--- /dev/null
+++ b/remoting/client/ios/facade/ios_client_runtime_delegate.mm
@@ -0,0 +1,64 @@
+// 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.
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+#include "remoting/client/ios/facade/ios_client_runtime_delegate.h"
+
+#import "base/mac/bind_objc_block.h"
+#import "remoting/client/ios/facade/remoting_service.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/memory/ptr_util.h"
+#include "base/memory/weak_ptr.h"
+
+namespace remoting {
+
+IosClientRuntimeDelegate::IosClientRuntimeDelegate() : weak_factory_(this) {
+ runtime_ = ChromotingClientRuntime::GetInstance();
Lambros 2017/04/21 18:17:04 Move to initialization-list?
nicholss 2017/04/21 18:45:28 I do it like this everywhere at the moment. If thi
+}
+
+IosClientRuntimeDelegate::~IosClientRuntimeDelegate() {}
+
+void IosClientRuntimeDelegate::RuntimeWillShutdown() {
+ DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
+ // Nothing to do.
+}
+
+void IosClientRuntimeDelegate::RuntimeDidShutdown() {
+ DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
+ // Nothing to do.
+}
+
+void IosClientRuntimeDelegate::RequestAuthTokenForLogger() {
+ if (!runtime_->ui_task_runner()->BelongsToCurrentThread()) {
+ runtime_->ui_task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&IosClientRuntimeDelegate::RequestAuthTokenForLogger,
+ base::Unretained(this)));
+ return;
+ }
+ // TODO(nicholss): Need to work out how to provide the logger with auth token
+ // at the correct time in the app. This was hanging the app bootup. Removing
+ // for now but this needs to happen the correct way soon.
+ // if ([[RemotingService SharedInstance] getUser]) {
+ // [[RemotingService SharedInstance]
+ // callbackWithAccessToken:base::BindBlockArc(
+ // ^(remoting::OAuthTokenGetter::Status status,
+ // const std::string& user_email, const std::string& access_token) {
+ // // TODO(nicholss): Check status.
+ // runtime_->log_writer()->SetAuthToken(access_token);
+ // })];
+ // }
+}
+
+base::WeakPtr<IosClientRuntimeDelegate> IosClientRuntimeDelegate::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/client/ios/facade/ios_client_runtime_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698