| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_vector.h" | |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
| 20 #include "components/autofill/core/browser/autofill_field.h" | 20 #include "components/autofill/core/browser/autofill_field.h" |
| 21 #include "components/autofill/core/browser/autofill_type.h" | 21 #include "components/autofill/core/browser/autofill_type.h" |
| 22 #include "components/autofill/core/browser/field_types.h" | 22 #include "components/autofill/core/browser/field_types.h" |
| 23 #include "components/autofill/core/browser/proto/server.pb.h" | 23 #include "components/autofill/core/browser/proto/server.pb.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 enum UploadRequired { | 26 enum UploadRequired { |
| 27 UPLOAD_NOT_REQUIRED, | 27 UPLOAD_NOT_REQUIRED, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 size_t field_count() const; | 181 size_t field_count() const; |
| 182 | 182 |
| 183 // Returns the number of fields that are part of the form signature and that | 183 // Returns the number of fields that are part of the form signature and that |
| 184 // are included in queries to the Autofill server. | 184 // are included in queries to the Autofill server. |
| 185 size_t active_field_count() const; | 185 size_t active_field_count() const; |
| 186 | 186 |
| 187 // Returns the number of fields that are able to be autofilled. | 187 // Returns the number of fields that are able to be autofilled. |
| 188 size_t autofill_count() const { return autofill_count_; } | 188 size_t autofill_count() const { return autofill_count_; } |
| 189 | 189 |
| 190 // Used for iterating over the fields. | 190 // Used for iterating over the fields. |
| 191 std::vector<AutofillField*>::const_iterator begin() const { | 191 std::vector<std::unique_ptr<AutofillField>>::const_iterator begin() const { |
| 192 return fields_.begin(); | 192 return fields_.cbegin(); |
| 193 } | 193 } |
| 194 std::vector<AutofillField*>::const_iterator end() const { | 194 std::vector<std::unique_ptr<AutofillField>>::const_iterator end() const { |
| 195 return fields_.end(); | 195 return fields_.cend(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 const base::string16& form_name() const { return form_name_; } | 198 const base::string16& form_name() const { return form_name_; } |
| 199 | 199 |
| 200 const GURL& source_url() const { return source_url_; } | 200 const GURL& source_url() const { return source_url_; } |
| 201 | 201 |
| 202 const GURL& target_url() const { return target_url_; } | 202 const GURL& target_url() const { return target_url_; } |
| 203 | 203 |
| 204 bool has_author_specified_types() { return has_author_specified_types_; } | 204 bool has_author_specified_types() { return has_author_specified_types_; } |
| 205 | 205 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // The source URL. | 267 // The source URL. |
| 268 GURL source_url_; | 268 GURL source_url_; |
| 269 | 269 |
| 270 // The target URL. | 270 // The target URL. |
| 271 GURL target_url_; | 271 GURL target_url_; |
| 272 | 272 |
| 273 // The number of fields able to be auto-filled. | 273 // The number of fields able to be auto-filled. |
| 274 size_t autofill_count_; | 274 size_t autofill_count_; |
| 275 | 275 |
| 276 // A vector of all the input fields in the form. | 276 // A vector of all the input fields in the form. |
| 277 ScopedVector<AutofillField> fields_; | 277 std::vector<std::unique_ptr<AutofillField>> fields_; |
| 278 | 278 |
| 279 // The number of fields that are part of the form signature and that are | 279 // The number of fields that are part of the form signature and that are |
| 280 // included in queries to the Autofill server. | 280 // included in queries to the Autofill server. |
| 281 size_t active_field_count_; | 281 size_t active_field_count_; |
| 282 | 282 |
| 283 // Whether the server expects us to always upload, never upload, or default | 283 // Whether the server expects us to always upload, never upload, or default |
| 284 // to the stored upload rates. | 284 // to the stored upload rates. |
| 285 UploadRequired upload_required_; | 285 UploadRequired upload_required_; |
| 286 | 286 |
| 287 // Whether the form includes any field types explicitly specified by the site | 287 // Whether the form includes any field types explicitly specified by the site |
| (...skipping 24 matching lines...) Expand all Loading... |
| 312 // The unique signature for this form, composed of the target url domain, | 312 // The unique signature for this form, composed of the target url domain, |
| 313 // the form name, and the form field names in a 64-bit hash. | 313 // the form name, and the form field names in a 64-bit hash. |
| 314 FormSignature form_signature_; | 314 FormSignature form_signature_; |
| 315 | 315 |
| 316 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 316 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 } // namespace autofill | 319 } // namespace autofill |
| 320 | 320 |
| 321 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 321 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| OLD | NEW |