blob: 6014c14fcd04642276833793e26513285d340856 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_
#define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_
#include <vector>
#include "base/strings/string16.h"
#include "components/autofill/core/common/form_field_data.h"
#include "url/gurl.h"
namespace autofill {
// Holds information about a form to be filled and/or submitted.
struct FormData {
FormData();
FormData(const FormData& data);
~FormData();
// Returns true if two forms are the same, not counting the values of the
// form elements.
bool SameFormAs(const FormData& other) const;
// Allow FormData to be a key in STL containers.
bool operator<(const FormData& form) const;
// The name of the form.
base::string16 name;
// The URL (minus query parameters) containing the form.
GURL origin;
// The action target of the form.
GURL action;
// True if this form is a form tag.
bool is_form_tag;
// True if the form is made of unowned fields in a non checkout flow.
bool is_formless_checkout;
// A vector of all the input fields in the form.
std::vector<FormFieldData> fields;
};
// For testing.
std::ostream& operator<<(std::ostream& os, const FormData& form);
// Serialize FormData. Used by the PasswordManager to persist FormData
// pertaining to password forms. Serialized data is appended to |pickle|.
void SerializeFormData(const FormData& form_data, base::Pickle* pickle);
// Deserialize FormData. This assumes that |iter| is currently pointing to
// the part of a pickle created by SerializeFormData. Returns true on success.
bool DeserializeFormData(base::PickleIterator* iter, FormData* form_data);
// Serialize FormData. Used by the PasswordManager to persist FormData
// pertaining to password forms in base64 string. It is useful since in some
// cases we need to store C strings without embedded '\0' symbols.
void SerializeFormDataToBase64String(const FormData& form_data,
std::string* output);
// Deserialize FormData. Returns true on success.
bool DeserializeFormDataFromBase64String(const base::StringPiece& input,
FormData* form_data);
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_
|