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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_section_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, 5 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_section_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
10 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" 10 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 [[suggestContainer_ view] setFrame:controlFrame]; 192 [[suggestContainer_ view] setFrame:controlFrame];
193 [suggestContainer_ performLayout]; 193 [suggestContainer_ performLayout];
194 [inputs_ setFrame:controlFrame]; 194 [inputs_ setFrame:controlFrame];
195 [label_ setFrame:labelFrame]; 195 [label_ setFrame:labelFrame];
196 [suggestButton_ setFrame:buttonFrame]; 196 [suggestButton_ setFrame:buttonFrame];
197 [view_ setFrameSize:viewFrame.size]; 197 [view_ setFrameSize:viewFrame.size];
198 } 198 }
199 199
200 - (NSTextField*)makeDetailSectionLabel:(NSString*)labelText { 200 - (NSTextField*)makeDetailSectionLabel:(NSString*)labelText {
201 scoped_nsobject<NSTextField> label([[NSTextField alloc] init]); 201 base::scoped_nsobject<NSTextField> label([[NSTextField alloc] init]);
202 [label setFont: 202 [label setFont:
203 [[NSFontManager sharedFontManager] convertFont:[label font] 203 [[NSFontManager sharedFontManager] convertFont:[label font]
204 toHaveTrait:NSBoldFontMask]]; 204 toHaveTrait:NSBoldFontMask]];
205 [label setStringValue:labelText]; 205 [label setStringValue:labelText];
206 [label sizeToFit]; 206 [label sizeToFit];
207 [label setEditable:NO]; 207 [label setEditable:NO];
208 [label setBordered:NO]; 208 [label setBordered:NO];
209 [label sizeToFit]; 209 [label sizeToFit];
210 return label.autorelease(); 210 return label.autorelease();
211 } 211 }
212 212
213 - (MenuButton*)makeSuggestionButton { 213 - (MenuButton*)makeSuggestionButton {
214 scoped_nsobject<MenuButton> button([[MenuButton alloc] init]); 214 base::scoped_nsobject<MenuButton> button([[MenuButton alloc] init]);
215 215
216 [button setOpenMenuOnClick:YES]; 216 [button setOpenMenuOnClick:YES];
217 [button setBordered:NO]; 217 [button setBordered:NO];
218 [button setShowsBorderOnlyWhileMouseInside:YES]; 218 [button setShowsBorderOnlyWhileMouseInside:YES];
219 219
220 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 220 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
221 NSImage* image = 221 NSImage* image =
222 rb.GetNativeImageNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON).ToNSImage(); 222 rb.GetNativeImageNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON).ToNSImage();
223 [[button cell] setImage:image 223 [[button cell] setImage:image
224 forButtonState:image_button_cell::kDefaultState]; 224 forButtonState:image_button_cell::kDefaultState];
(...skipping 13 matching lines...) Expand all
238 [button sizeToFit]; 238 [button sizeToFit];
239 return button.autorelease(); 239 return button.autorelease();
240 } 240 }
241 241
242 // TODO(estade): we should be using Chrome-style constrained window padding 242 // TODO(estade): we should be using Chrome-style constrained window padding
243 // values. 243 // values.
244 - (LayoutView*)makeInputControls { 244 - (LayoutView*)makeInputControls {
245 const autofill::DetailInputs& inputs = 245 const autofill::DetailInputs& inputs =
246 controller_->RequestedFieldsForSection(section_); 246 controller_->RequestedFieldsForSection(section_);
247 247
248 scoped_nsobject<LayoutView> view([[LayoutView alloc] init]); 248 base::scoped_nsobject<LayoutView> view([[LayoutView alloc] init]);
249 [view setLayoutManager: 249 [view setLayoutManager:
250 scoped_ptr<SimpleGridLayout>(new SimpleGridLayout(view))]; 250 scoped_ptr<SimpleGridLayout>(new SimpleGridLayout(view))];
251 SimpleGridLayout* layout = [view layoutManager]; 251 SimpleGridLayout* layout = [view layoutManager];
252 252
253 for (autofill::DetailInputs::const_iterator it = inputs.begin(); 253 for (autofill::DetailInputs::const_iterator it = inputs.begin();
254 it != inputs.end(); ++it) { 254 it != inputs.end(); ++it) {
255 const autofill::DetailInput& input = *it; 255 const autofill::DetailInput& input = *it;
256 int kColumnSetId = input.row_id; 256 int kColumnSetId = input.row_id;
257 ColumnSet* column_set = layout->GetColumnSet(kColumnSetId); 257 ColumnSet* column_set = layout->GetColumnSet(kColumnSetId);
258 if (!column_set) { 258 if (!column_set) {
259 // Create a new column set and row. 259 // Create a new column set and row.
260 column_set = layout->AddColumnSet(kColumnSetId); 260 column_set = layout->AddColumnSet(kColumnSetId);
261 if (it != inputs.begin()) 261 if (it != inputs.begin())
262 layout->AddPaddingRow(kRelatedControlVerticalSpacing); 262 layout->AddPaddingRow(kRelatedControlVerticalSpacing);
263 layout->StartRow(0, kColumnSetId); 263 layout->StartRow(0, kColumnSetId);
264 } else { 264 } else {
265 // Add a new column to existing row. 265 // Add a new column to existing row.
266 column_set->AddPaddingColumn(kRelatedControlHorizontalSpacing); 266 column_set->AddPaddingColumn(kRelatedControlHorizontalSpacing);
267 // Must explicitly skip the padding column since we've already started 267 // Must explicitly skip the padding column since we've already started
268 // adding views. 268 // adding views.
269 layout->SkipColumns(1); 269 layout->SkipColumns(1);
270 } 270 }
271 271
272 column_set->AddColumn(input.expand_weight ? input.expand_weight : 1.0f); 272 column_set->AddColumn(input.expand_weight ? input.expand_weight : 1.0f);
273 273
274 ui::ComboboxModel* input_model = 274 ui::ComboboxModel* input_model =
275 controller_->ComboboxModelForAutofillType(input.type); 275 controller_->ComboboxModelForAutofillType(input.type);
276 if (input_model) { 276 if (input_model) {
277 scoped_nsobject<NSPopUpButton> popup( 277 base::scoped_nsobject<NSPopUpButton> popup(
278 [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:YES]); 278 [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:YES]);
279 for (int i = 0; i < input_model->GetItemCount(); ++i) { 279 for (int i = 0; i < input_model->GetItemCount(); ++i) {
280 [popup addItemWithTitle: 280 [popup addItemWithTitle:
281 base::SysUTF16ToNSString(input_model->GetItemAt(i))]; 281 base::SysUTF16ToNSString(input_model->GetItemAt(i))];
282 } 282 }
283 [popup selectItemWithTitle:base::SysUTF16ToNSString(input.initial_value)]; 283 [popup selectItemWithTitle:base::SysUTF16ToNSString(input.initial_value)];
284 [popup sizeToFit]; 284 [popup sizeToFit];
285 [popup setTag:reinterpret_cast<NSInteger>(&input)]; 285 [popup setTag:reinterpret_cast<NSInteger>(&input)];
286 layout->AddView(popup); 286 layout->AddView(popup);
287 } else { 287 } else {
288 scoped_nsobject<AutofillTextField> field( 288 base::scoped_nsobject<AutofillTextField> field(
289 [[AutofillTextField alloc] init]); 289 [[AutofillTextField alloc] init]);
290 [[field cell] setPlaceholderString: 290 [[field cell] setPlaceholderString:
291 l10n_util::GetNSStringWithFixup(input.placeholder_text_rid)]; 291 l10n_util::GetNSStringWithFixup(input.placeholder_text_rid)];
292 [[field cell] setIcon: 292 [[field cell] setIcon:
293 controller_->IconForField( 293 controller_->IconForField(
294 input.type, input.initial_value).AsNSImage()]; 294 input.type, input.initial_value).AsNSImage()];
295 [[field cell] setInvalid:YES]; 295 [[field cell] setInvalid:YES];
296 [field sizeToFit]; 296 [field sizeToFit];
297 [field setTag:reinterpret_cast<NSInteger>(&input)]; 297 [field setTag:reinterpret_cast<NSInteger>(&input)];
298 layout->AddView(field); 298 layout->AddView(field);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 const autofill::DetailInput* detailInput = 351 const autofill::DetailInput* detailInput =
352 reinterpret_cast<autofill::DetailInput*>([control tag]); 352 reinterpret_cast<autofill::DetailInput*>([control tag]);
353 DCHECK(detailInput); 353 DCHECK(detailInput);
354 if (detailInput->type == type) 354 if (detailInput->type == type)
355 return control; 355 return control;
356 } 356 }
357 return nil; 357 return nil;
358 } 358 }
359 359
360 @end 360 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698