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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_common.h

Issue 974323002: Componentize autofill dialog common code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_
7
8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
9 #include "components/autofill/core/browser/autofill_metrics.h"
10 #include "components/autofill/core/browser/autofill_type.h"
11 #include "components/autofill/core/browser/field_types.h"
12
13 namespace autofill {
14 class AutofillProfile;
15 }
16
17 namespace wallet {
18 class Address;
19 }
20
21 namespace autofill {
22 namespace common {
23
24 // The types of addresses this class supports building.
25 enum AddressType {
26 ADDRESS_TYPE_BILLING,
27 ADDRESS_TYPE_SHIPPING,
28 };
29
30 // Returns true if |type| should be shown when |field_type| has been requested.
31 // This filters the types that we fill into the page to match the ones the
32 // dialog actually cares about, preventing rAc from giving away data that an
33 // AutofillProfile or other data source might know about the user which isn't
34 // represented in the dialog.
35 bool ServerTypeEncompassesFieldType(ServerFieldType type,
36 const AutofillType& field_type);
37
38 // Returns true if |type| in the given |section| should be used for a
39 // site-requested |field|.
40 bool ServerTypeMatchesField(DialogSection section,
41 ServerFieldType type,
42 const AutofillField& field);
43
44 // Returns true if the |type| belongs to the CREDIT_CARD field type group.
45 bool IsCreditCardType(ServerFieldType type);
46
47 // Constructs |inputs| from the array of inputs in |input_template|.
48 void BuildInputs(const DetailInput input_template[],
49 size_t template_size,
50 DetailInputs* inputs);
51
52 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
53 // to the |section|.
54 AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent(
55 DialogSection section);
56
57 // Returns the AutofillMetrics::DIALOG_UI_*_ITEM_ADDED metric corresponding
58 // to the |section|.
59 AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent(
60 DialogSection section);
61
62 // Gets just the |type| attributes from each DetailInput.
63 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs);
64
65 } // namespace common
66 } // namespace autofill
67
68 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698