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

Side by Side Diff: chrome/browser/autofill/autocheckout_manager.cc

Issue 11539003: Pop up requestAutocomplete UI when autofill server hints chrome client that it is in a multipage au… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolve with AutofillDialogController refactoring. Created 7 years, 11 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
OLDNEW
(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/autofill/autofill_manager.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
11 #include "chrome/common/form_data.h"
12 #include "chrome/common/form_field_data.h"
13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/ssl_status.h"
15 #include "googleurl/src/gurl.h"
16
17 using content::SSLStatus;
18 using content::WebContents;
19
20 namespace {
21
22 // Build FormFieldData based on the supplied |autocomplete_attribute|. Will
23 // fill rest of properties with default values.
24 FormFieldData BuildField(const std::string& autocomplete_attribute) {
25 FormFieldData field;
26 field.name = string16();
27 field.value = string16();
28 field.autocomplete_attribute = autocomplete_attribute;
29 field.form_control_type = "text";
30 return field;
31 }
32
33 // Build Autocheckout specific form data to be consumed by
34 // AutofillDialogController to show the Autocheckout specific UI.
35 FormData BuildAutocheckoutFormData() {
36 FormData formdata;
37 formdata.fields.push_back(BuildField("name"));
38 formdata.fields.push_back(BuildField("email"));
39 formdata.fields.push_back(BuildField("cc-name"));
40 formdata.fields.push_back(BuildField("cc-number"));
41 formdata.fields.push_back(BuildField("cc-exp"));
42 formdata.fields.push_back(BuildField("cc-csc"));
43 formdata.fields.push_back(BuildField("billing street-address"));
44 formdata.fields.push_back(BuildField("billing locality"));
45 formdata.fields.push_back(BuildField("billing region"));
46 formdata.fields.push_back(BuildField("billing country"));
47 formdata.fields.push_back(BuildField("billing postal-code"));
48 formdata.fields.push_back(BuildField("shipping street-address"));
49 formdata.fields.push_back(BuildField("shipping locality"));
50 formdata.fields.push_back(BuildField("shipping region"));
51 formdata.fields.push_back(BuildField("shipping country"));
52 formdata.fields.push_back(BuildField("shipping postal-code"));
53 return formdata;
54 }
55
56 } // namespace
57
58 AutocheckoutManager::AutocheckoutManager(AutofillManager* autofill_manager)
59 : autofill_manager_(autofill_manager),
60 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
61 }
62
63 AutocheckoutManager::~AutocheckoutManager() {
64 }
65
66 void AutocheckoutManager::ShowAutocheckoutDialog(
67 const GURL& frame_url,
68 const SSLStatus& ssl_status) {
69 base::Callback<void(const FormStructure*)> callback =
70 base::Bind(&AutocheckoutManager::ReturnAutocheckoutData,
71 weak_ptr_factory_.GetWeakPtr());
72 autofill::AutofillDialogControllerImpl* controller =
73 new autofill::AutofillDialogControllerImpl(
74 autofill_manager_->GetWebContents(),
75 BuildAutocheckoutFormData(),
76 frame_url,
77 ssl_status,
78 callback);
79 controller->Show();
80 }
81
82 void AutocheckoutManager::ReturnAutocheckoutData(const FormStructure* result) {
83 // TODO(ramankk): Parse the response FormStructure.
84 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autocheckout_manager.h ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698