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 #include "components/autofill/core/common/form_field_data.h" | 5 #include "components/autofill/core/common/form_field_data.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/autofill/core/common/autofill_util.h" |
10 | 11 |
11 namespace autofill { | 12 namespace autofill { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // Increment this anytime pickle format is modified as well as provide | 16 // Increment this anytime pickle format is modified as well as provide |
16 // deserialization routine from previous kPickleVersion format. | 17 // deserialization routine from previous kPickleVersion format. |
17 const int kPickleVersion = 6; | 18 const int kPickleVersion = 6; |
18 | 19 |
19 void AddVectorToPickle(std::vector<base::string16> strings, | 20 void AddVectorToPickle(std::vector<base::string16> strings, |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 << base::UTF16ToUTF8(field.value) << " " << field.form_control_type | 344 << base::UTF16ToUTF8(field.value) << " " << field.form_control_type |
344 << " " << field.autocomplete_attribute << " " << field.placeholder | 345 << " " << field.autocomplete_attribute << " " << field.placeholder |
345 << " " << field.max_length << " " << field.css_classes << " " | 346 << " " << field.max_length << " " << field.css_classes << " " |
346 << (field.is_autofilled ? "true" : "false") << " " | 347 << (field.is_autofilled ? "true" : "false") << " " |
347 << check_status_str << (field.is_focusable ? "true" : "false") | 348 << check_status_str << (field.is_focusable ? "true" : "false") |
348 << " " << (field.should_autocomplete ? "true" : "false") << " " | 349 << " " << (field.should_autocomplete ? "true" : "false") << " " |
349 << role_str << " " << field.text_direction << " " | 350 << role_str << " " << field.text_direction << " " |
350 << field.properties_mask; | 351 << field.properties_mask; |
351 } | 352 } |
352 | 353 |
353 bool IsCheckable(const FormFieldData::CheckStatus& check_status) { | |
354 return check_status != FormFieldData::CheckStatus::NOT_CHECKABLE; | |
355 } | |
356 | |
357 bool IsChecked(const FormFieldData::CheckStatus& check_status) { | |
358 return check_status == FormFieldData::CheckStatus::CHECKED; | |
359 } | |
360 | |
361 void SetCheckStatus(FormFieldData* form_field_data, | |
362 bool isCheckable, | |
363 bool isChecked) { | |
364 if (isChecked) { | |
365 form_field_data->check_status = FormFieldData::CheckStatus::CHECKED; | |
366 } else { | |
367 if (isCheckable) { | |
368 form_field_data->check_status = | |
369 FormFieldData::CheckStatus::CHECKABLE_BUT_UNCHECKED; | |
370 } else { | |
371 form_field_data->check_status = FormFieldData::CheckStatus::NOT_CHECKABLE; | |
372 } | |
373 } | |
374 } | |
375 | |
376 } // namespace autofill | 354 } // namespace autofill |
OLD | NEW |