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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm

Issue 51933002: [rAC, OSX] Autofill popup should be shown on 2nd click. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test helper. Created 7 years, 1 month 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: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
index 2751e272df0273623ec577c0dd34337d8d441ce5..0198b582c8bbdf38cfb63950ddd058f7fb784e9c 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/mac/bundle_locations.h"
+#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
@@ -14,10 +15,12 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
#include "content/public/browser/web_contents.h"
@@ -243,6 +246,28 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
@end
+
+#pragma mark Field Editor
+
+@interface AutofillDialogFieldEditor : NSTextView
+@end
+
+
+@implementation AutofillDialogFieldEditor
+
+- (void)mouseDown:(NSEvent*)event {
+ // Delegate _must_ be notified before mouseDown is complete, since it needs
+ // to distinguish between mouseDown for already focused fields, and fields
+ // that will receive focus as part of the mouseDown.
+ AutofillTextField* textfield =
+ base::mac::ObjCCastStrict<AutofillTextField>([self delegate]);
+ [textfield onEditorMouseDown:self];
+ [super mouseDown:event];
+}
+
+@end
+
+
#pragma mark Window Controller
@interface AutofillDialogWindowController ()
@@ -258,6 +283,24 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
@end
+
+@implementation AutofillDialogWindowController (NSWindowDelegate)
+
+- (id)windowWillReturnFieldEditor:(NSWindow*)window toObject:(id)client {
+ AutofillTextField* textfield = base::mac::ObjCCast<AutofillTextField>(client);
+ if (!textfield)
+ return nil;
+
+ if (!fieldEditor_) {
+ fieldEditor_.reset([[AutofillDialogFieldEditor alloc] init]);
+ [fieldEditor_ setFieldEditor:YES];
+ }
+ return fieldEditor_.get();
+}
+
+@end
+
+
@implementation AutofillDialogWindowController
- (id)initWithWebContents:(content::WebContents*)webContents
@@ -269,6 +312,7 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
initWithContentRect:ui::kWindowSizeDeterminedLater]);
if ((self = [super initWithWindow:window])) {
+ [window setDelegate:self];
webContents_ = webContents;
autofillDialog_ = autofillDialog;
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h ('k') | chrome/browser/ui/cocoa/autofill/autofill_input_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698