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/authentication/signin_interaction_controller.h" | 5 #import "ios/chrome/browser/ui/authentication/signin_interaction_controller.h" |
6 | 6 |
7 #include "base/ios/weak_nsobject.h" | 7 #include "base/ios/weak_nsobject.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/scoped_block.h" | 9 #include "base/mac/scoped_block.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
12 #include "components/prefs/pref_service.h" | 12 #include "components/prefs/pref_service.h" |
13 #include "components/signin/core/browser/signin_manager.h" | 13 #include "components/signin/core/browser/signin_manager.h" |
14 #include "components/signin/core/common/signin_pref_names.h" | 14 #include "components/signin/core/common/signin_pref_names.h" |
15 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" | 15 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" |
16 #include "ios/chrome/browser/signin/authentication_service.h" | 16 #include "ios/chrome/browser/signin/authentication_service.h" |
17 #include "ios/chrome/browser/signin/authentication_service_factory.h" | 17 #include "ios/chrome/browser/signin/authentication_service_factory.h" |
18 #include "ios/chrome/browser/signin/signin_manager_factory.h" | 18 #include "ios/chrome/browser/signin/signin_manager_factory.h" |
19 #import "ios/chrome/browser/signin/signin_util.h" | 19 #import "ios/chrome/browser/signin/signin_util.h" |
20 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" | 20 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" |
21 #import "ios/chrome/browser/ui/authentication/authentication_ui_util.h" | 21 #import "ios/chrome/browser/ui/authentication/authentication_ui_util.h" |
22 #import "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h" | 22 #import "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h" |
23 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 23 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 24 #import "ios/chrome/browser/ui/util/top_view_controller.h" |
24 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 25 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
25 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" | 26 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" |
26 #import "ios/public/provider/chrome/browser/signin/chrome_identity_interaction_m
anager.h" | 27 #import "ios/public/provider/chrome/browser/signin/chrome_identity_interaction_m
anager.h" |
27 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 28 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
28 | 29 |
29 using signin_ui::CompletionCallback; | 30 using signin_ui::CompletionCallback; |
30 | 31 |
31 @interface SigninInteractionController ()< | 32 @interface SigninInteractionController ()< |
32 ChromeIdentityInteractionManagerDelegate, | 33 ChromeIdentityInteractionManagerDelegate, |
33 ChromeSigninViewControllerDelegate> { | 34 ChromeSigninViewControllerDelegate> { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 [self runCompletionCallbackWithSuccess:NO executeCommand:nil]; | 194 [self runCompletionCallbackWithSuccess:NO executeCommand:nil]; |
194 return; | 195 return; |
195 } | 196 } |
196 | 197 |
197 base::WeakNSObject<SigninInteractionController> weakSelf(self); | 198 base::WeakNSObject<SigninInteractionController> weakSelf(self); |
198 ProceduralBlock dismissAction = ^{ | 199 ProceduralBlock dismissAction = ^{ |
199 [weakSelf runCompletionCallbackWithSuccess:NO executeCommand:nil]; | 200 [weakSelf runCompletionCallbackWithSuccess:NO executeCommand:nil]; |
200 }; | 201 }; |
201 | 202 |
202 alertCoordinator_.reset([ios_internal::ErrorCoordinator( | 203 alertCoordinator_.reset([ios_internal::ErrorCoordinator( |
203 error, dismissAction, viewController) retain]); | 204 error, dismissAction, |
| 205 top_view_controller::TopPresentedViewControllerFrom(viewController)) |
| 206 retain]); |
204 [alertCoordinator_ start]; | 207 [alertCoordinator_ start]; |
205 return; | 208 return; |
206 } | 209 } |
207 if (shouldSignIn) { | 210 if (shouldSignIn) { |
208 [self showSigninViewControllerWithIdentity:identity]; | 211 [self showSigninViewControllerWithIdentity:identity]; |
209 } else { | 212 } else { |
210 [self runCompletionCallbackWithSuccess:YES executeCommand:nil]; | 213 [self runCompletionCallbackWithSuccess:YES executeCommand:nil]; |
211 } | 214 } |
212 } | 215 } |
213 | 216 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 completionCallback_.get()(success); | 368 completionCallback_.get()(success); |
366 completionCallback_.reset(); | 369 completionCallback_.reset(); |
367 } | 370 } |
368 strongSelf.reset(); | 371 strongSelf.reset(); |
369 if (command) { | 372 if (command) { |
370 [presentingViewController chromeExecuteCommand:command]; | 373 [presentingViewController chromeExecuteCommand:command]; |
371 } | 374 } |
372 } | 375 } |
373 | 376 |
374 @end | 377 @end |
OLD | NEW |