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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 23756007: [rac] Show amex specific cvc hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move icon dependency logic into controller for testability Created 7 years, 3 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
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 iter != updated_inputs.end(); ++iter) { 2011 iter != updated_inputs.end(); ++iter) {
2012 const DetailInput& input = *iter; 2012 const DetailInput& input = *iter;
2013 TextfieldMap::iterator text_mapping = group->textfields.find(&input); 2013 TextfieldMap::iterator text_mapping = group->textfields.find(&input);
2014 2014
2015 if (text_mapping != group->textfields.end()) { 2015 if (text_mapping != group->textfields.end()) {
2016 DecoratedTextfield* decorated = text_mapping->second; 2016 DecoratedTextfield* decorated = text_mapping->second;
2017 decorated->SetEnabled(input.editable); 2017 decorated->SetEnabled(input.editable);
2018 if (decorated->text().empty() || clobber_inputs) { 2018 if (decorated->text().empty() || clobber_inputs) {
2019 decorated->SetText(iter->initial_value); 2019 decorated->SetText(iter->initial_value);
2020 decorated->SetIcon( 2020 decorated->SetIcon(
2021 delegate_->IconForField(input.type, decorated->text())); 2021 delegate_->IconForField(input.type, decorated->text()));
Evan Stade 2013/09/11 00:17:03 I don't think this will work any more.
2022 } 2022 }
2023 } 2023 }
2024 2024
2025 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); 2025 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input);
2026 if (combo_mapping != group->comboboxes.end()) { 2026 if (combo_mapping != group->comboboxes.end()) {
2027 views::Combobox* combobox = combo_mapping->second; 2027 views::Combobox* combobox = combo_mapping->second;
2028 combobox->SetEnabled(input.editable); 2028 combobox->SetEnabled(input.editable);
2029 if (combobox->selected_index() == combobox->model()->GetDefaultIndex() || 2029 if (combobox->selected_index() == combobox->model()->GetDefaultIndex() ||
2030 clobber_inputs) { 2030 clobber_inputs) {
2031 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { 2031 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 2249
2250 // If the field is marked as invalid, check if the text is now valid. 2250 // If the field is marked as invalid, check if the text is now valid.
2251 // Many fields (i.e. CC#) are invalid for most of the duration of editing, 2251 // Many fields (i.e. CC#) are invalid for most of the duration of editing,
2252 // so flagging them as invalid prematurely is not helpful. However, 2252 // so flagging them as invalid prematurely is not helpful. However,
2253 // correcting a minor mistake (i.e. a wrong CC digit) should immediately 2253 // correcting a minor mistake (i.e. a wrong CC digit) should immediately
2254 // result in validation - positive user feedback. 2254 // result in validation - positive user feedback.
2255 if (decorated->invalid() && was_edit) { 2255 if (decorated->invalid() && was_edit) {
2256 SetValidityForInput<DecoratedTextfield>( 2256 SetValidityForInput<DecoratedTextfield>(
2257 decorated, 2257 decorated,
2258 delegate_->InputValidityMessage(group->section, type, 2258 delegate_->InputValidityMessage(group->section, type,
2259 textfield->text())); 2259 textfield->text()));
2260 2260
2261 // If the field transitioned from invalid to valid, re-validate the group, 2261 // If the field transitioned from invalid to valid, re-validate the group,
2262 // since inter-field checks become meaningful with valid fields. 2262 // since inter-field checks become meaningful with valid fields.
2263 if (!decorated->invalid()) 2263 if (!decorated->invalid())
2264 ValidateGroup(*group, VALIDATE_EDIT); 2264 ValidateGroup(*group, VALIDATE_EDIT);
2265 } 2265 }
2266 2266
2267 gfx::Image icon = delegate_->IconForField(type, textfield->text()); 2267 if (!delegate_->IsIconDependentField(type))
2268 decorated->SetIcon(icon); 2268 decorated->SetIcon(delegate_->IconForField(type, textfield->text()));
2269
2270 ServerFieldType dependent_type = UNKNOWN_TYPE;
2271 if (delegate_->IsIconDependencyField(type, &dependent_type)) {
2272 DecoratedTextfield* dependent_field =
2273 DecoratedTextfieldForServerFieldType(group, dependent_type);
2274 if (dependent_field) {
2275 dependent_field->SetIcon(
2276 delegate_->IconForField(dependent_type, textfield->text()));
Evan Stade 2013/09/11 00:17:03 API abuse! you're passing a type and a textval tha
please use gerrit instead 2013/09/11 16:27:40 How about adding an API call "IconForDependentFiel
2277 }
2278 }
2269 } 2279 }
2270 2280
2271 void AutofillDialogViews::UpdateButtonStripExtraView() { 2281 void AutofillDialogViews::UpdateButtonStripExtraView() {
2272 save_in_chrome_checkbox_container_->SetVisible( 2282 save_in_chrome_checkbox_container_->SetVisible(
2273 delegate_->ShouldOfferToSaveInChrome()); 2283 delegate_->ShouldOfferToSaveInChrome());
2274 2284
2275 gfx::Image image = delegate_->ButtonStripImage(); 2285 gfx::Image image = delegate_->ButtonStripImage();
2276 button_strip_image_->SetVisible(!image.IsEmpty()); 2286 button_strip_image_->SetVisible(!image.IsEmpty());
2277 button_strip_image_->SetImage(image.AsImageSkia()); 2287 button_strip_image_->SetImage(image.AsImageSkia());
2278 } 2288 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 } 2356 }
2347 2357
2348 return NULL; 2358 return NULL;
2349 } 2359 }
2350 2360
2351 void AutofillDialogViews::DetailsContainerBoundsChanged() { 2361 void AutofillDialogViews::DetailsContainerBoundsChanged() {
2352 if (error_bubble_) 2362 if (error_bubble_)
2353 error_bubble_->UpdatePosition(); 2363 error_bubble_->UpdatePosition();
2354 } 2364 }
2355 2365
2366 DecoratedTextfield* AutofillDialogViews::DecoratedTextfieldForServerFieldType(
2367 const DetailsGroup* group,
2368 ServerFieldType type) const {
2369 for (TextfieldMap::const_iterator field_iter = group->textfields.begin();
2370 field_iter != group->textfields.end();
2371 ++field_iter) {
2372 if (field_iter->first->type == type)
2373 return field_iter->second;
2374 }
2375
2376 return NULL;
2377 }
2378
2356 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) 2379 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
2357 : section(section), 2380 : section(section),
2358 container(NULL), 2381 container(NULL),
2359 manual_input(NULL), 2382 manual_input(NULL),
2360 suggested_info(NULL), 2383 suggested_info(NULL),
2361 suggested_button(NULL) {} 2384 suggested_button(NULL) {}
2362 2385
2363 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} 2386 AutofillDialogViews::DetailsGroup::~DetailsGroup() {}
2364 2387
2365 } // namespace autofill 2388 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698