| Index: third_party/grpc/examples/objective-c/auth_sample/SelectUserViewController.m
|
| diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h b/third_party/grpc/examples/objective-c/auth_sample/SelectUserViewController.m
|
| similarity index 52%
|
| copy from third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
|
| copy to third_party/grpc/examples/objective-c/auth_sample/SelectUserViewController.m
|
| index a6fa87d7ef65d50525b5d0a8c6a2253477037dbb..954c531f3fba771e9ce9941d80986d1f054829a0 100644
|
| --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
|
| +++ b/third_party/grpc/examples/objective-c/auth_sample/SelectUserViewController.m
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2009 Google Inc. All rights reserved.
|
| + *
|
| + * Copyright 2015, Google Inc.
|
| + * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -26,37 +28,59 @@
|
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + *
|
| */
|
| -#ifndef DedicatedWorkerThread_h
|
| -#define DedicatedWorkerThread_h
|
|
|
| -#include "core/workers/WorkerThread.h"
|
| +#import "SelectUserViewController.h"
|
| +
|
| +#import "MakeRPCViewController.h"
|
| +
|
| +@implementation SelectUserViewController
|
| +
|
| +- (void)viewDidLoad {
|
| + [super viewDidLoad];
|
| +
|
| + self.signOutButton.layer.cornerRadius = 5;
|
| + self.signOutButton.hidden = YES;
|
| +
|
| + // As instructed in https://developers.google.com/identity/sign-in/ios/sign-in
|
| + GIDSignIn *signIn = GIDSignIn.sharedInstance;
|
| + signIn.delegate = self;
|
| + signIn.uiDelegate = self;
|
|
|
| -namespace blink {
|
| + // As instructed in https://developers.google.com/identity/sign-in/ios/additional-scopes
|
| + if (![signIn.scopes containsObject:kTestScope]) {
|
| + signIn.scopes = [signIn.scopes arrayByAddingObject:kTestScope];
|
| + }
|
|
|
| -class InProcessWorkerObjectProxy;
|
| -class WorkerThreadStartupData;
|
| + [signIn signInSilently];
|
| +}
|
|
|
| -class DedicatedWorkerThread final : public WorkerThread {
|
| -public:
|
| - static PassOwnPtr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin);
|
| - ~DedicatedWorkerThread() override;
|
| +- (void)signIn:(GIDSignIn *)signIn
|
| +didSignInForUser:(GIDGoogleUser *)user
|
| + withError:(NSError *)error {
|
| + if (error) {
|
| + // The user probably cancelled the sign-in flow.
|
| + return;
|
| + }
|
|
|
| - WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; }
|
| - InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
|
| + self.mainLabel.text = [NSString stringWithFormat:@"User: %@", user.profile.email];
|
| + NSString *scopes = [user.accessibleScopes componentsJoinedByString:@", "];
|
| + scopes = scopes.length ? scopes : @"(none)";
|
| + self.subLabel.text = [NSString stringWithFormat:@"Scopes: %@", scopes];
|
|
|
| -protected:
|
| - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override;
|
| - void postInitialize() override;
|
| + self.signInButton.hidden = YES;
|
| + self.signOutButton.hidden = NO;
|
| +}
|
|
|
| -private:
|
| - DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin);
|
| +- (IBAction)didTapSignOut {
|
| + [GIDSignIn.sharedInstance signOut];
|
|
|
| - OwnPtr<WorkerBackingThread> m_workerBackingThread;
|
| - InProcessWorkerObjectProxy& m_workerObjectProxy;
|
| - double m_timeOrigin;
|
| -};
|
| + self.mainLabel.text = @"Please sign in.";
|
| + self.subLabel.text = @"";
|
|
|
| -} // namespace blink
|
| + self.signInButton.hidden = NO;
|
| + self.signOutButton.hidden = YES;
|
| +}
|
|
|
| -#endif // DedicatedWorkerThread_h
|
| +@end
|
|
|