OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/ui/commands/show_signin_command.h" | 5 #import "ios/chrome/browser/ui/commands/show_signin_command.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_block.h" | 8 #include "base/mac/scoped_block.h" |
9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
10 | 10 |
11 @implementation ShowSigninCommand { | 11 @implementation ShowSigninCommand { |
12 base::mac::ScopedBlock<ShowSigninCommandCompletionCallback> _callback; | 12 base::mac::ScopedBlock<ShowSigninCommandCompletionCallback> _callback; |
13 } | 13 } |
14 | 14 |
15 @synthesize operation = _operation; | 15 @synthesize operation = _operation; |
16 @synthesize signInSource = _signInSource; | 16 @synthesize signInSource = _signInSource; |
| 17 @synthesize signInAccessPoint = _signInAccessPoint; |
17 | 18 |
18 - (instancetype)initWithTag:(NSInteger)tag { | 19 - (instancetype)initWithTag:(NSInteger)tag { |
19 NOTREACHED(); | 20 NOTREACHED(); |
20 return nil; | 21 return nil; |
21 } | 22 } |
22 | 23 |
23 - (instancetype)initWithOperation:(AuthenticationOperation)operation | 24 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
24 signInSource:(SignInSource)signInSource | 25 signInSource:(SignInSource)signInSource |
25 callback: | 26 callback: |
26 (ShowSigninCommandCompletionCallback)callback { | 27 (ShowSigninCommandCompletionCallback)callback { |
27 if ((self = [super initWithTag:IDC_SHOW_SIGNIN_IOS])) { | 28 if ((self = [super initWithTag:IDC_SHOW_SIGNIN_IOS])) { |
28 _operation = operation; | 29 _operation = operation; |
29 _signInSource = signInSource; | 30 _signInSource = signInSource; |
30 _callback.reset(callback, base::scoped_policy::RETAIN); | 31 _callback.reset(callback, base::scoped_policy::RETAIN); |
31 } | 32 } |
32 return self; | 33 return self; |
33 } | 34 } |
34 | 35 |
35 - (instancetype)initWithOperation:(AuthenticationOperation)operation | 36 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
36 signInSource:(SignInSource)signInSource { | 37 signInSource:(SignInSource)signInSource { |
37 return | 38 return |
38 [self initWithOperation:operation signInSource:signInSource callback:nil]; | 39 [self initWithOperation:operation signInSource:signInSource callback:nil]; |
39 } | 40 } |
40 | 41 |
| 42 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
| 43 signInAccessPoint:(signin_metrics::AccessPoint)signInAccessPoint |
| 44 callback: |
| 45 (ShowSigninCommandCompletionCallback)callback { |
| 46 if ((self = [self initWithOperation:operation |
| 47 signInSource:SIGN_IN_SOURCE_OTHER |
| 48 callback:callback])) { |
| 49 _signInAccessPoint = signInAccessPoint; |
| 50 } |
| 51 return self; |
| 52 } |
| 53 |
| 54 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
| 55 signInAccessPoint: |
| 56 (signin_metrics::AccessPoint)signInAccessPoint { |
| 57 return [self initWithOperation:operation |
| 58 signInAccessPoint:signInAccessPoint |
| 59 callback:nil]; |
| 60 } |
| 61 |
41 - (ShowSigninCommandCompletionCallback)callback { | 62 - (ShowSigninCommandCompletionCallback)callback { |
42 return _callback.get(); | 63 return _callback.get(); |
43 } | 64 } |
44 | 65 |
45 @end | 66 @end |
OLD | NEW |