| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_section_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 edited:(BOOL)edited { | 399 edited:(BOOL)edited { |
| 400 autofill::ServerFieldType type = [self fieldTypeForControl:field]; | 400 autofill::ServerFieldType type = [self fieldTypeForControl:field]; |
| 401 base::string16 fieldValue = base::SysNSStringToUTF16([field fieldValue]); | 401 base::string16 fieldValue = base::SysNSStringToUTF16([field fieldValue]); |
| 402 | 402 |
| 403 // Get the frame rectangle for the designated field, in screen coordinates. | 403 // Get the frame rectangle for the designated field, in screen coordinates. |
| 404 NSRect textFrameInScreen = [field convertRect:[field bounds] toView:nil]; | 404 NSRect textFrameInScreen = [field convertRect:[field bounds] toView:nil]; |
| 405 textFrameInScreen.origin = | 405 textFrameInScreen.origin = |
| 406 [[field window] convertBaseToScreen:textFrameInScreen.origin]; | 406 [[field window] convertBaseToScreen:textFrameInScreen.origin]; |
| 407 | 407 |
| 408 // And adjust for gfx::Rect being flipped compared to OSX coordinates. | 408 // And adjust for gfx::Rect being flipped compared to OSX coordinates. |
| 409 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 409 NSScreen* screen = [[NSScreen screens] firstObject]; |
| 410 textFrameInScreen.origin.y = | 410 textFrameInScreen.origin.y = |
| 411 NSMaxY([screen frame]) - NSMaxY(textFrameInScreen); | 411 NSMaxY([screen frame]) - NSMaxY(textFrameInScreen); |
| 412 gfx::Rect textFrameRect(NSRectToCGRect(textFrameInScreen)); | 412 gfx::Rect textFrameRect(NSRectToCGRect(textFrameInScreen)); |
| 413 | 413 |
| 414 delegate_->UserEditedOrActivatedInput(section_, | 414 delegate_->UserEditedOrActivatedInput(section_, |
| 415 type, | 415 type, |
| 416 [self view], | 416 [self view], |
| 417 textFrameRect, | 417 textFrameRect, |
| 418 fieldValue, | 418 fieldValue, |
| 419 edited); | 419 edited); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 747 |
| 748 - (void)activateFieldForType:(autofill::ServerFieldType)type { | 748 - (void)activateFieldForType:(autofill::ServerFieldType)type { |
| 749 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:type]; | 749 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:type]; |
| 750 if (field) { | 750 if (field) { |
| 751 [[field window] makeFirstResponder:field]; | 751 [[field window] makeFirstResponder:field]; |
| 752 [self fieldEditedOrActivated:field edited:NO]; | 752 [self fieldEditedOrActivated:field edited:NO]; |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 | 755 |
| 756 @end | 756 @end |
| OLD | NEW |