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

Side by Side Diff: components/autofill/content/browser/autocheckout_manager.cc

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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "components/autofill/content/browser/autocheckout_manager.h" 5 #include "components/autofill/content/browser/autocheckout_manager.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/content/browser/autocheckout_request_manager.h" 10 #include "components/autofill/content/browser/autocheckout_request_manager.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 callback); 135 callback);
136 136
137 net::CookieOptions cookie_options; 137 net::CookieOptions cookie_options;
138 cookie_options.set_include_httponly(); 138 cookie_options.set_include_httponly();
139 cookie_store->GetCookiesWithOptionsAsync(GURL(kGoogleAccountsUrl), 139 cookie_store->GetCookiesWithOptionsAsync(GURL(kGoogleAccountsUrl),
140 cookie_options, 140 cookie_options,
141 cookie_callback); 141 cookie_callback);
142 } 142 }
143 143
144 bool IsBillingGroup(FieldTypeGroup group) { 144 bool IsBillingGroup(FieldTypeGroup group) {
145 return group == AutofillType::ADDRESS_BILLING || 145 return group == ADDRESS_BILLING ||
146 group == AutofillType::PHONE_BILLING || 146 group == PHONE_BILLING ||
147 group == AutofillType::NAME_BILLING; 147 group == NAME_BILLING;
148 } 148 }
149 149
150 const char kTransactionIdNotSet[] = "transaction id not set"; 150 const char kTransactionIdNotSet[] = "transaction id not set";
151 151
152 } // namespace 152 } // namespace
153 153
154 AutocheckoutManager::AutocheckoutManager(AutofillManager* autofill_manager) 154 AutocheckoutManager::AutocheckoutManager(AutofillManager* autofill_manager)
155 : autofill_manager_(autofill_manager), 155 : autofill_manager_(autofill_manager),
156 metric_logger_(new AutofillMetrics), 156 metric_logger_(new AutofillMetrics),
157 should_show_bubble_(true), 157 should_show_bubble_(true),
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 billing_address_.reset(new AutofillProfile()); 354 billing_address_.reset(new AutofillProfile());
355 355
356 for (size_t i = 0; i < result->field_count(); ++i) { 356 for (size_t i = 0; i < result->field_count(); ++i) {
357 AutofillFieldType type = result->field(i)->type(); 357 AutofillFieldType type = result->field(i)->type();
358 const base::string16& value = result->field(i)->value; 358 const base::string16& value = result->field(i)->value;
359 if (type == CREDIT_CARD_VERIFICATION_CODE) { 359 if (type == CREDIT_CARD_VERIFICATION_CODE) {
360 cvv_ = result->field(i)->value; 360 cvv_ = result->field(i)->value;
361 continue; 361 continue;
362 } 362 }
363 FieldTypeGroup group = AutofillType(type).group(); 363 FieldTypeGroup group = AutofillType(type).group();
364 if (group == AutofillType::CREDIT_CARD) { 364 if (group == CREDIT_CARD) {
365 credit_card_->SetRawInfo(type, value); 365 credit_card_->SetRawInfo(type, value);
366 // TODO(dgwallinga): Find a way of cleanly deprecating CREDIT_CARD_NAME. 366 // TODO(dgwallinga): Find a way of cleanly deprecating CREDIT_CARD_NAME.
367 // code.google.com/p/chromium/issues/detail?id=263498 367 // code.google.com/p/chromium/issues/detail?id=263498
368 if (type == CREDIT_CARD_NAME) 368 if (type == CREDIT_CARD_NAME)
369 billing_address_->SetRawInfo(NAME_BILLING_FULL, value); 369 billing_address_->SetRawInfo(NAME_BILLING_FULL, value);
370 } else if (type == ADDRESS_HOME_COUNTRY) { 370 } else if (type == ADDRESS_HOME_COUNTRY) {
371 profile_->SetInfo(type, value, autofill_manager_->app_locale()); 371 profile_->SetInfo(type, value, autofill_manager_->app_locale());
372 } else if (type == ADDRESS_BILLING_COUNTRY) { 372 } else if (type == ADDRESS_BILLING_COUNTRY) {
373 billing_address_->SetInfo(type, value, autofill_manager_->app_locale()); 373 billing_address_->SetInfo(type, value, autofill_manager_->app_locale());
374 } else if (IsBillingGroup(group)) { 374 } else if (IsBillingGroup(group)) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 486 }
487 return; 487 return;
488 } 488 }
489 489
490 // Handle verification code directly. 490 // Handle verification code directly.
491 if (type == CREDIT_CARD_VERIFICATION_CODE) { 491 if (type == CREDIT_CARD_VERIFICATION_CODE) {
492 field_to_fill->value = cvv_; 492 field_to_fill->value = cvv_;
493 return; 493 return;
494 } 494 }
495 495
496 if (AutofillType(type).group() == AutofillType::CREDIT_CARD) { 496 if (AutofillType(type).group() == CREDIT_CARD) {
497 credit_card_->FillFormField( 497 credit_card_->FillFormField(
498 field, 0, autofill_manager_->app_locale(), field_to_fill); 498 field, 0, autofill_manager_->app_locale(), field_to_fill);
499 } else if (IsBillingGroup(AutofillType(type).group())) { 499 } else if (IsBillingGroup(AutofillType(type).group())) {
500 billing_address_->FillFormField( 500 billing_address_->FillFormField(
501 field, 0, autofill_manager_->app_locale(), field_to_fill); 501 field, 0, autofill_manager_->app_locale(), field_to_fill);
502 } else { 502 } else {
503 profile_->FillFormField( 503 profile_->FillFormField(
504 field, 0, autofill_manager_->app_locale(), field_to_fill); 504 field, 0, autofill_manager_->app_locale(), field_to_fill);
505 } 505 }
506 } 506 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 SendAutocheckoutStatus(status); 570 SendAutocheckoutStatus(status);
571 if (status == SUCCESS) 571 if (status == SUCCESS)
572 autofill_manager_->delegate()->OnAutocheckoutSuccess(); 572 autofill_manager_->delegate()->OnAutocheckoutSuccess();
573 else 573 else
574 autofill_manager_->delegate()->OnAutocheckoutError(); 574 autofill_manager_->delegate()->OnAutocheckoutError();
575 in_autocheckout_flow_ = false; 575 in_autocheckout_flow_ = false;
576 } 576 }
577 577
578 } // namespace autofill 578 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.cc ('k') | components/autofill/content/browser/wallet/wallet_items.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698