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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/passwords/passwords_ui_delegate_impl.mm
diff --git a/ios/chrome/browser/passwords/passwords_ui_delegate_impl.mm b/ios/chrome/browser/passwords/passwords_ui_delegate_impl.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8fad3842e0da398314bd667e82e20c9eca901f56
--- /dev/null
+++ b/ios/chrome/browser/passwords/passwords_ui_delegate_impl.mm
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
+
+#import "ios/chrome/browser/passwords/password_generation_prompt_view.h"
+#import "ios/chrome/browser/passwords/password_generation_prompt_view_controller.h"
+
+@implementation PasswordsUiDelegateImpl
+
+#pragma mark -
+#pragma mark PasswordsUiDelegate
+
+- (void)showGenerationAlertWithPassword:(NSString*)password
+ andPromptDelegate:
+ (id<PasswordGenerationPromptDelegate>)delegate {
+ UIViewController* topViewController =
+ [[[UIApplication sharedApplication] keyWindow] rootViewController];
+
+ // Look for the top-most presented ViewController.
+ for (UIViewController* controller = topViewController.presentedViewController;
+ controller && ![controller isBeingDismissed];
+ controller = controller.presentedViewController) {
+ // Return if a PasswordGenerationPromptViewController is already presented.
+ if ([controller
+ isKindOfClass:[PasswordGenerationPromptViewController class]])
+ return;
+
+ topViewController = controller;
+ }
+
+ PasswordGenerationPromptDialog* contentView =
+ [[[PasswordGenerationPromptDialog alloc]
+ initWithDelegate:delegate
+ viewController:topViewController] autorelease];
+
+ UIViewController* viewController =
+ [[[PasswordGenerationPromptViewController alloc]
+ initWithPassword:password
+ contentView:contentView
+ viewController:topViewController] autorelease];
+
+ [topViewController presentViewController:viewController
+ animated:YES
+ completion:nil];
+}
+
+- (void)hideGenerationAlert {
+ UIViewController* rootViewController =
+ [[[UIApplication sharedApplication] keyWindow] rootViewController];
+
+ // Check every presented ViewController for a password generation prompt.
+ for (UIViewController* controller = rootViewController;
+ controller && ![controller isBeingDismissed];
+ controller = controller.presentedViewController) {
+ if ([controller.presentedViewController
+ isKindOfClass:[PasswordGenerationPromptViewController class]]) {
+ // Dismiss the password prompt.
+ [controller dismissViewControllerAnimated:NO completion:nil];
+ return;
+ }
+ }
+}
+
+@end
« 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