Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 6 #error "This file requires ARC support." | |
| 7 #endif | |
| 8 | |
| 9 #include "remoting/client/ios/facade/ios_client_runtime_delegate.h" | |
| 10 | |
| 11 #import "base/mac/bind_objc_block.h" | |
| 12 #import "remoting/client/ios/facade/remoting_service.h" | |
| 13 | |
| 14 #include "base/bind.h" | |
| 15 #include "base/logging.h" | |
| 16 #include "base/macros.h" | |
| 17 #include "base/memory/ptr_util.h" | |
| 18 #include "base/memory/weak_ptr.h" | |
| 19 | |
| 20 namespace remoting { | |
| 21 | |
| 22 IosClientRuntimeDelegate::IosClientRuntimeDelegate() : weak_factory_(this) { | |
| 23 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
| |
| 24 } | |
| 25 | |
| 26 IosClientRuntimeDelegate::~IosClientRuntimeDelegate() {} | |
| 27 | |
| 28 void IosClientRuntimeDelegate::RuntimeWillShutdown() { | |
| 29 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | |
| 30 // Nothing to do. | |
| 31 } | |
| 32 | |
| 33 void IosClientRuntimeDelegate::RuntimeDidShutdown() { | |
| 34 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | |
| 35 // Nothing to do. | |
| 36 } | |
| 37 | |
| 38 void IosClientRuntimeDelegate::RequestAuthTokenForLogger() { | |
| 39 if (!runtime_->ui_task_runner()->BelongsToCurrentThread()) { | |
| 40 runtime_->ui_task_runner()->PostTask( | |
| 41 FROM_HERE, | |
| 42 base::Bind(&IosClientRuntimeDelegate::RequestAuthTokenForLogger, | |
| 43 base::Unretained(this))); | |
| 44 return; | |
| 45 } | |
| 46 // TODO(nicholss): Need to work out how to provide the logger with auth token | |
| 47 // at the correct time in the app. This was hanging the app bootup. Removing | |
| 48 // for now but this needs to happen the correct way soon. | |
| 49 // if ([[RemotingService SharedInstance] getUser]) { | |
| 50 // [[RemotingService SharedInstance] | |
| 51 // callbackWithAccessToken:base::BindBlockArc( | |
| 52 // ^(remoting::OAuthTokenGetter::Status status, | |
| 53 // const std::string& user_email, const std::string& access_token) { | |
| 54 // // TODO(nicholss): Check status. | |
| 55 // runtime_->log_writer()->SetAuthToken(access_token); | |
| 56 // })]; | |
| 57 // } | |
| 58 } | |
| 59 | |
| 60 base::WeakPtr<IosClientRuntimeDelegate> IosClientRuntimeDelegate::GetWeakPtr() { | |
| 61 return weak_factory_.GetWeakPtr(); | |
| 62 } | |
| 63 | |
| 64 } // namespace remoting | |
| OLD | NEW |