OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 - (void)mouseDown:(NSEvent*)event { | 49 - (void)mouseDown:(NSEvent*)event { |
50 // Delegate _must_ be notified before mouseDown is complete, since it needs | 50 // Delegate _must_ be notified before mouseDown is complete, since it needs |
51 // to distinguish between mouseDown for already focused fields, and fields | 51 // to distinguish between mouseDown for already focused fields, and fields |
52 // that will receive focus as part of the mouseDown. | 52 // that will receive focus as part of the mouseDown. |
53 AutofillTextField* textfield = | 53 AutofillTextField* textfield = |
54 base::mac::ObjCCastStrict<AutofillTextField>([self delegate]); | 54 base::mac::ObjCCastStrict<AutofillTextField>([self delegate]); |
55 [textfield onEditorMouseDown:self]; | 55 [textfield onEditorMouseDown:self]; |
56 [super mouseDown:event]; | 56 [super mouseDown:event]; |
57 } | 57 } |
58 | 58 |
| 59 // Intercept key down messages and forward them to the text fields delegate. |
| 60 // This needs to happen in the field editor, since it handles all keyDown |
| 61 // messages for NSTextField. |
| 62 - (void)keyDown:(NSEvent*)event { |
| 63 AutofillTextField* textfield = |
| 64 base::mac::ObjCCastStrict<AutofillTextField>([self delegate]); |
| 65 if ([[textfield inputDelegate] keyEvent:event |
| 66 forInput:textfield] != kKeyEventHandled) { |
| 67 [super keyDown:event]; |
| 68 } |
| 69 } |
| 70 |
59 @end | 71 @end |
60 | 72 |
61 | 73 |
62 #pragma mark Window Controller | 74 #pragma mark Window Controller |
63 | 75 |
64 @interface AutofillDialogWindowController () | 76 @interface AutofillDialogWindowController () |
65 | 77 |
66 // Compute maximum allowed height for the dialog. | 78 // Compute maximum allowed height for the dialog. |
67 - (CGFloat)maxHeight; | 79 - (CGFloat)maxHeight; |
68 | 80 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 435 |
424 - (content::WebContents*)getSignInWebContents { | 436 - (content::WebContents*)getSignInWebContents { |
425 return [signInContainer_ webContents]; | 437 return [signInContainer_ webContents]; |
426 } | 438 } |
427 | 439 |
428 - (BOOL)isShowingOverlay { | 440 - (BOOL)isShowingOverlay { |
429 return ![[overlayController_ view] isHidden]; | 441 return ![[overlayController_ view] isHidden]; |
430 } | 442 } |
431 | 443 |
432 @end | 444 @end |
OLD | NEW |