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

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

Issue 21947003: [Autofill] Move FieldTypeGroup out of the AutofillType class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 <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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 *line2 = text.substr(position + line_return.length()); 66 *line2 = text.substr(position + line_return.length());
67 } 67 }
68 } 68 }
69 69
70 // If the Autofill data comes from a credit card, make sure to overwrite the 70 // If the Autofill data comes from a credit card, make sure to overwrite the
71 // CC comboboxes (even if they already have something in them). If the 71 // CC comboboxes (even if they already have something in them). If the
72 // Autofill data comes from an AutofillProfile, leave the comboboxes alone. 72 // Autofill data comes from an AutofillProfile, leave the comboboxes alone.
73 // TODO(groby): This kind of logic should _really_ live on the controller. 73 // TODO(groby): This kind of logic should _really_ live on the controller.
74 bool ShouldOverwriteComboboxes(autofill::DialogSection section, 74 bool ShouldOverwriteComboboxes(autofill::DialogSection section,
75 autofill::AutofillFieldType type) { 75 autofill::AutofillFieldType type) {
76 using autofill::AutofillType; 76 if (autofill::AutofillType(type).group() != autofill::CREDIT_CARD) {
77 if (AutofillType(type).group() != AutofillType::CREDIT_CARD) {
78 return false; 77 return false;
79 } 78 }
80 79
81 if (section == autofill::SECTION_CC) { 80 if (section == autofill::SECTION_CC) {
82 return true; 81 return true;
83 } 82 }
84 83
85 return section == autofill::SECTION_CC_BILLING; 84 return section == autofill::SECTION_CC_BILLING;
86 } 85 }
87 86
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 [field setFieldValue:@""]; 319 [field setFieldValue:@""];
321 320
322 if (ShouldOverwriteComboboxes(section_, input.type)) { 321 if (ShouldOverwriteComboboxes(section_, input.type)) {
323 for (NSControl* control in [inputs_ subviews]) { 322 for (NSControl* control in [inputs_ subviews]) {
324 AutofillPopUpButton* popup = 323 AutofillPopUpButton* popup =
325 base::mac::ObjCCast<AutofillPopUpButton>(control); 324 base::mac::ObjCCast<AutofillPopUpButton>(control);
326 if (popup) { 325 if (popup) {
327 autofill::AutofillFieldType fieldType = 326 autofill::AutofillFieldType fieldType =
328 [self fieldTypeForControl:popup]; 327 [self fieldTypeForControl:popup];
329 if (autofill::AutofillType(fieldType).group() == 328 if (autofill::AutofillType(fieldType).group() ==
330 autofill::AutofillType::CREDIT_CARD) { 329 autofill::CREDIT_CARD) {
331 ui::ComboboxModel* model = 330 ui::ComboboxModel* model =
332 controller_->ComboboxModelForAutofillType(fieldType); 331 controller_->ComboboxModelForAutofillType(fieldType);
333 DCHECK(model); 332 DCHECK(model);
334 [popup selectItemAtIndex:model->GetDefaultIndex()]; 333 [popup selectItemAtIndex:model->GetDefaultIndex()];
335 } 334 }
336 } 335 }
337 } 336 }
338 } 337 }
339 338
340 [self updateAndClobber:NO]; 339 [self updateAndClobber:NO];
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 623
625 - (void)activateFieldForInput:(const autofill::DetailInput&)input { 624 - (void)activateFieldForInput:(const autofill::DetailInput&)input {
626 if ([self detailInputForType:input.type] != &input) 625 if ([self detailInputForType:input.type] != &input)
627 return; 626 return;
628 627
629 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; 628 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type];
630 [[field window] makeFirstResponder:field]; 629 [[field window] makeFirstResponder:field];
631 } 630 }
632 631
633 @end 632 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.cc ('k') | chrome/browser/ui/views/autofill/autofill_dialog_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698