| 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_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 13 #include "components/autofill/core/common/autofill_constants.h" | 14 #include "components/autofill/core/common/autofill_constants.h" |
| 14 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 15 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| 15 #include "third_party/WebKit/public/platform/WebVector.h" | 16 #include "third_party/WebKit/public/platform/WebVector.h" |
| 16 #include "third_party/WebKit/public/web/WebElementCollection.h" | 17 #include "third_party/WebKit/public/web/WebElementCollection.h" |
| 17 #include "ui/gfx/geometry/rect_f.h" | 18 #include "ui/gfx/geometry/rect_f.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 // The maximum number of form fields we are willing to parse, due to | 53 // The maximum number of form fields we are willing to parse, due to |
| 53 // computational costs. Several examples of forms with lots of fields that are | 54 // computational costs. Several examples of forms with lots of fields that are |
| 54 // not relevant to Autofill: (1) the Netflix queue; (2) the Amazon wishlist; | 55 // not relevant to Autofill: (1) the Netflix queue; (2) the Amazon wishlist; |
| 55 // (3) router configuration pages; and (4) other configuration pages, e.g. for | 56 // (3) router configuration pages; and (4) other configuration pages, e.g. for |
| 56 // Google code project settings. | 57 // Google code project settings. |
| 57 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. | 58 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. |
| 58 extern const size_t kMaxParseableFields; | 59 extern const size_t kMaxParseableFields; |
| 59 | 60 |
| 61 // Create an instance of ScopedLayoutPreventer to stop form_util code from |
| 62 // triggering layout as a side-effect. For example, when creating a |
| 63 // FormFieldData, a call to WebNode::isFocusable is normally made, which may |
| 64 // trigger a layout computation. When an instance of ScopedLayoutPreventer is |
| 65 // alive, that call will not be made. On destruction, this class allows |
| 66 // layout-triggering calls again. It is not thread safe and multiple instances |
| 67 // should not be created at the same time in the same process. |
| 68 class ScopedLayoutPreventer { |
| 69 public: |
| 70 ScopedLayoutPreventer(); |
| 71 ~ScopedLayoutPreventer(); |
| 72 |
| 73 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(ScopedLayoutPreventer); |
| 75 }; |
| 76 |
| 60 // Extract FormData from the form element and return whether the operation was | 77 // Extract FormData from the form element and return whether the operation was |
| 61 // successful. | 78 // successful. |
| 62 bool ExtractFormData(const blink::WebFormElement& form_element, FormData* data); | 79 bool ExtractFormData(const blink::WebFormElement& form_element, FormData* data); |
| 63 | 80 |
| 64 // Helper function to check if there exist any form on |frame| where its action | 81 // Helper function to check if there exist any form on |frame| where its action |
| 65 // equals |action|. Returns true if so. For forms with empty or unspecified | 82 // equals |action|. Returns true if so. For forms with empty or unspecified |
| 66 // actions, all form data are used for comparison. Form data comparison is | 83 // actions, all form data are used for comparison. Form data comparison is |
| 67 // disabled on Mac and Android because the update prompt isn't implemented. | 84 // disabled on Mac and Android because the update prompt isn't implemented. |
| 68 // It may cause many false password updates. | 85 // It may cause many false password updates. |
| 69 // TODO(kolos) Turn on all data comparing when the update prompt will be | 86 // TODO(kolos) Turn on all data comparing when the update prompt will be |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // |input_element|. Note that |user_input| cannot be easily derived from | 254 // |input_element|. Note that |user_input| cannot be easily derived from |
| 238 // |input_element| by calling value(), because of http://crbug.com/507714. | 255 // |input_element| by calling value(), because of http://crbug.com/507714. |
| 239 void PreviewSuggestion(const base::string16& suggestion, | 256 void PreviewSuggestion(const base::string16& suggestion, |
| 240 const base::string16& user_input, | 257 const base::string16& user_input, |
| 241 blink::WebFormControlElement* input_element); | 258 blink::WebFormControlElement* input_element); |
| 242 | 259 |
| 243 } // namespace form_util | 260 } // namespace form_util |
| 244 } // namespace autofill | 261 } // namespace autofill |
| 245 | 262 |
| 246 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ | 263 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
| OLD | NEW |