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

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

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
6
7 #import "ios/chrome/browser/passwords/password_generation_prompt_view.h"
8 #import "ios/chrome/browser/passwords/password_generation_prompt_view_controller .h"
9
10 @implementation PasswordsUiDelegateImpl
11
12 #pragma mark -
13 #pragma mark PasswordsUiDelegate
14
15 - (void)showGenerationAlertWithPassword:(NSString*)password
16 andPromptDelegate:
17 (id<PasswordGenerationPromptDelegate>)delegate {
18 UIViewController* topViewController =
19 [[[UIApplication sharedApplication] keyWindow] rootViewController];
20
21 // Look for the top-most presented ViewController.
22 for (UIViewController* controller = topViewController.presentedViewController;
23 controller && ![controller isBeingDismissed];
24 controller = controller.presentedViewController) {
25 // Return if a PasswordGenerationPromptViewController is already presented.
26 if ([controller
27 isKindOfClass:[PasswordGenerationPromptViewController class]])
28 return;
29
30 topViewController = controller;
31 }
32
33 PasswordGenerationPromptDialog* contentView =
34 [[[PasswordGenerationPromptDialog alloc]
35 initWithDelegate:delegate
36 viewController:topViewController] autorelease];
37
38 UIViewController* viewController =
39 [[[PasswordGenerationPromptViewController alloc]
40 initWithPassword:password
41 contentView:contentView
42 viewController:topViewController] autorelease];
43
44 [topViewController presentViewController:viewController
45 animated:YES
46 completion:nil];
47 }
48
49 - (void)hideGenerationAlert {
50 UIViewController* rootViewController =
51 [[[UIApplication sharedApplication] keyWindow] rootViewController];
52
53 // Check every presented ViewController for a password generation prompt.
54 for (UIViewController* controller = rootViewController;
55 controller && ![controller isBeingDismissed];
56 controller = controller.presentedViewController) {
57 if ([controller.presentedViewController
58 isKindOfClass:[PasswordGenerationPromptViewController class]]) {
59 // Dismiss the password prompt.
60 [controller dismissViewControllerAnimated:NO completion:nil];
61 return;
62 }
63 }
64 }
65
66 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/passwords/passwords_ui_delegate_impl.h ('k') | ios/chrome/browser/payments/cells/order_summary_line_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698