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

Side by Side Diff: ios/chrome/browser/passwords/passwords_ui_delegate_impl.mm

Issue 2932333002: [ObjC ARC] Converts ios/chrome/browser/passwords:passwords_internal to ARC. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/passwords/password_generation_prompt_view_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/passwords/passwords_ui_delegate_impl.h" 5 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
6 6
7 #import "ios/chrome/browser/passwords/password_generation_prompt_view.h" 7 #import "ios/chrome/browser/passwords/password_generation_prompt_view.h"
8 #import "ios/chrome/browser/passwords/password_generation_prompt_view_controller .h" 8 #import "ios/chrome/browser/passwords/password_generation_prompt_view_controller .h"
9 9
10 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support."
12 #endif
13
10 @implementation PasswordsUiDelegateImpl 14 @implementation PasswordsUiDelegateImpl
11 15
12 #pragma mark - 16 #pragma mark -
13 #pragma mark PasswordsUiDelegate 17 #pragma mark PasswordsUiDelegate
14 18
15 - (void)showGenerationAlertWithPassword:(NSString*)password 19 - (void)showGenerationAlertWithPassword:(NSString*)password
16 andPromptDelegate: 20 andPromptDelegate:
17 (id<PasswordGenerationPromptDelegate>)delegate { 21 (id<PasswordGenerationPromptDelegate>)delegate {
18 UIViewController* topViewController = 22 UIViewController* topViewController =
19 [[[UIApplication sharedApplication] keyWindow] rootViewController]; 23 [[[UIApplication sharedApplication] keyWindow] rootViewController];
20 24
21 // Look for the top-most presented ViewController. 25 // Look for the top-most presented ViewController.
22 for (UIViewController* controller = topViewController.presentedViewController; 26 for (UIViewController* controller = topViewController.presentedViewController;
23 controller && ![controller isBeingDismissed]; 27 controller && ![controller isBeingDismissed];
24 controller = controller.presentedViewController) { 28 controller = controller.presentedViewController) {
25 // Return if a PasswordGenerationPromptViewController is already presented. 29 // Return if a PasswordGenerationPromptViewController is already presented.
26 if ([controller 30 if ([controller
27 isKindOfClass:[PasswordGenerationPromptViewController class]]) 31 isKindOfClass:[PasswordGenerationPromptViewController class]])
28 return; 32 return;
29 33
30 topViewController = controller; 34 topViewController = controller;
31 } 35 }
32 36
33 PasswordGenerationPromptDialog* contentView = 37 PasswordGenerationPromptDialog* contentView =
34 [[[PasswordGenerationPromptDialog alloc] 38 [[PasswordGenerationPromptDialog alloc]
35 initWithDelegate:delegate 39 initWithDelegate:delegate
36 viewController:topViewController] autorelease]; 40 viewController:topViewController];
37 41
38 UIViewController* viewController = 42 UIViewController* viewController =
39 [[[PasswordGenerationPromptViewController alloc] 43 [[PasswordGenerationPromptViewController alloc]
40 initWithPassword:password 44 initWithPassword:password
41 contentView:contentView 45 contentView:contentView
42 viewController:topViewController] autorelease]; 46 viewController:topViewController];
43 47
44 [topViewController presentViewController:viewController 48 [topViewController presentViewController:viewController
45 animated:YES 49 animated:YES
46 completion:nil]; 50 completion:nil];
47 } 51 }
48 52
49 - (void)hideGenerationAlert { 53 - (void)hideGenerationAlert {
50 UIViewController* rootViewController = 54 UIViewController* rootViewController =
51 [[[UIApplication sharedApplication] keyWindow] rootViewController]; 55 [[[UIApplication sharedApplication] keyWindow] rootViewController];
52 56
53 // Check every presented ViewController for a password generation prompt. 57 // Check every presented ViewController for a password generation prompt.
54 for (UIViewController* controller = rootViewController; 58 for (UIViewController* controller = rootViewController;
55 controller && ![controller isBeingDismissed]; 59 controller && ![controller isBeingDismissed];
56 controller = controller.presentedViewController) { 60 controller = controller.presentedViewController) {
57 if ([controller.presentedViewController 61 if ([controller.presentedViewController
58 isKindOfClass:[PasswordGenerationPromptViewController class]]) { 62 isKindOfClass:[PasswordGenerationPromptViewController class]]) {
59 // Dismiss the password prompt. 63 // Dismiss the password prompt.
60 [controller dismissViewControllerAnimated:NO completion:nil]; 64 [controller dismissViewControllerAnimated:NO completion:nil];
61 return; 65 return;
62 } 66 }
63 } 67 }
64 } 68 }
65 69
66 @end 70 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/passwords/password_generation_prompt_view_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698