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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm

Issue 1380083005: Mac: Use [NSArray firstObject] for [NSScreen screens] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.mm ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698