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

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

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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 | Annotate | Revision Log
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_main_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" 10 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
(...skipping 17 matching lines...) Expand all
28 - (id)initWithController:(autofill::AutofillDialogController*)controller { 28 - (id)initWithController:(autofill::AutofillDialogController*)controller {
29 if (self = [super init]) { 29 if (self = [super init]) {
30 controller_ = controller; 30 controller_ = controller;
31 } 31 }
32 return self; 32 return self;
33 } 33 }
34 34
35 - (void)loadView { 35 - (void)loadView {
36 [self buildWindowButtonsForFrame:NSZeroRect]; 36 [self buildWindowButtonsForFrame:NSZeroRect];
37 37
38 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); 38 base::scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]);
39 [view setAutoresizesSubviews:YES]; 39 [view setAutoresizesSubviews:YES];
40 [view setSubviews:@[buttonContainer_]]; 40 [view setSubviews:@[buttonContainer_]];
41 [self setView:view]; 41 [self setView:view];
42 42
43 [self layoutButtons]; 43 [self layoutButtons];
44 44
45 detailsContainer_.reset( 45 detailsContainer_.reset(
46 [[AutofillDetailsContainer alloc] initWithController:controller_]); 46 [[AutofillDetailsContainer alloc] initWithController:controller_]);
47 NSSize frameSize = [[detailsContainer_ view] frame].size; 47 NSSize frameSize = [[detailsContainer_ view] frame].size;
48 [[detailsContainer_ view] setFrameOrigin: 48 [[detailsContainer_ view] setFrameOrigin:
(...skipping 21 matching lines...) Expand all
70 70
71 - (void)buildWindowButtonsForFrame:(NSRect)frame { 71 - (void)buildWindowButtonsForFrame:(NSRect)frame {
72 if (buttonContainer_.get()) 72 if (buttonContainer_.get())
73 return; 73 return;
74 74
75 buttonContainer_.reset([[GTMWidthBasedTweaker alloc] initWithFrame: 75 buttonContainer_.reset([[GTMWidthBasedTweaker alloc] initWithFrame:
76 ui::kWindowSizeDeterminedLater]); 76 ui::kWindowSizeDeterminedLater]);
77 [buttonContainer_ 77 [buttonContainer_
78 setAutoresizingMask:(NSViewMinXMargin | NSViewMaxYMargin)]; 78 setAutoresizingMask:(NSViewMinXMargin | NSViewMaxYMargin)];
79 79
80 scoped_nsobject<NSButton> button( 80 base::scoped_nsobject<NSButton> button(
81 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 81 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
82 [button setTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL)]; 82 [button setTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL)];
83 [button setKeyEquivalent:kKeyEquivalentEscape]; 83 [button setKeyEquivalent:kKeyEquivalentEscape];
84 [button setTarget:target_]; 84 [button setTarget:target_];
85 [button setAction:@selector(cancel:)]; 85 [button setAction:@selector(cancel:)];
86 [button sizeToFit]; 86 [button sizeToFit];
87 [buttonContainer_ addSubview:button]; 87 [buttonContainer_ addSubview:button];
88 88
89 CGFloat nextX = NSMaxX([button frame]) + kButtonGap; 89 CGFloat nextX = NSMaxX([button frame]) + kButtonGap;
90 button.reset([[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 90 button.reset([[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
91 [button setFrameOrigin:NSMakePoint(nextX, 0)]; 91 [button setFrameOrigin:NSMakePoint(nextX, 0)];
92 [button setTitle:l10n_util::GetNSStringWithFixup( 92 [button setTitle:l10n_util::GetNSStringWithFixup(
93 IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON)]; 93 IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON)];
94 [button setKeyEquivalent:kKeyEquivalentReturn]; 94 [button setKeyEquivalent:kKeyEquivalentReturn];
95 [button setTarget:target_]; 95 [button setTarget:target_];
96 [button setAction:@selector(accept:)]; 96 [button setAction:@selector(accept:)];
97 [button sizeToFit]; 97 [button sizeToFit];
98 [buttonContainer_ addSubview:button]; 98 [buttonContainer_ addSubview:button];
99 99
100 frame = NSMakeRect( 100 frame = NSMakeRect(
101 NSWidth(frame) - NSMaxX([button frame]), 0, 101 NSWidth(frame) - NSMaxX([button frame]), 0,
102 NSMaxX([button frame]), NSHeight([button frame])); 102 NSMaxX([button frame]), NSHeight([button frame]));
103 103
104 [buttonContainer_ setFrame:frame]; 104 [buttonContainer_ setFrame:frame];
105 } 105 }
106 106
107 - (void)layoutButtons { 107 - (void)layoutButtons {
108 scoped_nsobject<GTMUILocalizerAndLayoutTweaker> layoutTweaker( 108 base::scoped_nsobject<GTMUILocalizerAndLayoutTweaker> layoutTweaker(
109 [[GTMUILocalizerAndLayoutTweaker alloc] init]); 109 [[GTMUILocalizerAndLayoutTweaker alloc] init]);
110 [layoutTweaker tweakUI:buttonContainer_]; 110 [layoutTweaker tweakUI:buttonContainer_];
111 } 111 }
112 112
113 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section { 113 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section {
114 return [detailsContainer_ sectionForId:section]; 114 return [detailsContainer_ sectionForId:section];
115 } 115 }
116 116
117 - (void)modelChanged { 117 - (void)modelChanged {
118 [detailsContainer_ modelChanged]; 118 [detailsContainer_ modelChanged];
119 } 119 }
120 120
121 @end 121 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698