Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/autofill/autocheckout_manager.h" | |
| 6 | |
| 7 #include "base/basictypes.h" | |
| 8 #include "base/bind.h" | |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | |
| 10 #include "chrome/common/form_data.h" | |
| 11 #include "chrome/common/form_field_data.h" | |
| 12 #include "content/public/browser/web_contents.h" | |
| 13 #include "content/public/common/ssl_status.h" | |
| 14 #include "googleurl/src/gurl.h" | |
| 15 | |
| 16 using content::SSLStatus; | |
| 17 using content::WebContents; | |
| 18 | |
| 19 // static | |
| 20 FormFieldData AutocheckoutManager::BuildField( | |
| 21 const std::string& autocomplete_attribute) { | |
| 22 FormFieldData field; | |
| 23 field.name = string16(); | |
| 24 field.value = string16(); | |
| 25 field.autocomplete_attribute = autocomplete_attribute; | |
| 26 field.form_control_type = "text"; | |
| 27 return field; | |
| 28 } | |
| 29 | |
| 30 // static | |
| 31 FormData AutocheckoutManager::BuildAutocheckoutFormData() { | |
| 32 FormData formdata; | |
| 33 formdata.fields.push_back(BuildField("name")); | |
| 34 formdata.fields.push_back(BuildField("email")); | |
| 35 formdata.fields.push_back(BuildField("cc-name")); | |
| 36 formdata.fields.push_back(BuildField("cc-number")); | |
| 37 formdata.fields.push_back(BuildField("cc-exp")); | |
| 38 formdata.fields.push_back(BuildField("cc-csc")); | |
| 39 formdata.fields.push_back(BuildField("billing street-address")); | |
| 40 formdata.fields.push_back(BuildField("billing locality")); | |
| 41 formdata.fields.push_back(BuildField("billing region")); | |
| 42 formdata.fields.push_back(BuildField("billing country")); | |
| 43 formdata.fields.push_back(BuildField("billing postal-code")); | |
| 44 formdata.fields.push_back(BuildField("shipping street-address")); | |
| 45 formdata.fields.push_back(BuildField("shipping locality")); | |
| 46 formdata.fields.push_back(BuildField("shipping region")); | |
| 47 formdata.fields.push_back(BuildField("shipping country")); | |
| 48 formdata.fields.push_back(BuildField("shipping postal-code")); | |
| 49 return formdata; | |
| 50 } | |
| 51 | |
| 52 void AutocheckoutManager::ShowAutocheckoutDialog( | |
| 53 const GURL& frame_url, const SSLStatus& ssl_status, | |
|
Ilya Sherman
2013/01/17 01:21:44
nit: Each parameter should be on its own line.
Raman Kakilate
2013/01/17 06:40:33
Done.
| |
| 54 WebContents* web_contents) { | |
| 55 base::Callback<void(const FormStructure*)> callback = | |
| 56 base::Bind(&AutocheckoutManager::ReturnAutocheckoutData, this); | |
| 57 autofill::AutofillDialogController* controller = | |
| 58 new autofill::AutofillDialogController(web_contents, | |
| 59 BuildAutocheckoutFormData(), | |
| 60 frame_url, | |
| 61 ssl_status, | |
| 62 callback); | |
| 63 controller->Show(); | |
| 64 } | |
| 65 | |
| 66 void AutocheckoutManager::ReturnAutocheckoutData(const FormStructure* result) { | |
| 67 // TODO(ramankk): Parse the response FormStructure. | |
| 68 } | |
| 69 | |
| 70 AutocheckoutManager::~AutocheckoutManager() {} | |
| OLD | NEW |