Don't preload rarely seen large images
[chromium-blink-merge.git] / components / autofill / core / common / form_data.h
blob7ea2107c4271ce53576a3b8e4e8ef009f5d33346
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.
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "components/autofill/core/common/form_field_data.h"
12 #include "url/gurl.h"
14 namespace autofill {
16 // Holds information about a form to be filled and/or submitted.
17 struct FormData {
18 FormData();
19 FormData(const FormData& data);
20 ~FormData();
22 // Returns true if two forms are the same, not counting the values of the
23 // form elements.
24 bool SameFormAs(const FormData& other) const;
26 // Allow FormData to be a key in STL containers.
27 bool operator<(const FormData& form) const;
29 // The name of the form.
30 base::string16 name;
31 // The URL (minus query parameters) containing the form.
32 GURL origin;
33 // The action target of the form.
34 GURL action;
35 // true if this form was submitted by a user gesture and not javascript.
36 bool user_submitted;
37 // true if this form is a form tag.
38 bool is_form_tag;
39 // A vector of all the input fields in the form.
40 std::vector<FormFieldData> fields;
43 // For testing.
44 std::ostream& operator<<(std::ostream& os, const FormData& form);
46 // Serialize FormData. Used by the PasswordManager to persist FormData
47 // pertaining to password forms. Serialized data is appended to |pickle|.
48 void SerializeFormData(const FormData& form_data, base::Pickle* pickle);
49 // Deserialize FormData. This assumes that |iter| is currently pointing to
50 // the part of a pickle created by SerializeFormData. Returns true on success.
51 bool DeserializeFormData(base::PickleIterator* iter, FormData* form_data);
53 // Serialize FormData. Used by the PasswordManager to persist FormData
54 // pertaining to password forms in base64 string. It is useful since in some
55 // cases we need to store C strings without embedded '\0' symbols.
56 void SerializeFormDataToBase64String(const FormData& form_data,
57 std::string* output);
58 // Deserialize FormData. Returns true on success.
59 bool DeserializeFormDataFromBase64String(const base::StringPiece& input,
60 FormData* form_data);
62 } // namespace autofill
64 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_