Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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. | |
| 4 | |
| 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ | |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "third_party/WebKit/public/web/WebInputElement.h" | |
| 12 | |
| 13 namespace autofill { | |
| 14 | |
| 15 struct PasswordForm; | |
| 16 | |
| 17 // Represents a possibly submitted password form. | |
| 18 class ProvisionallySavedForm { | |
| 19 public: | |
| 20 ProvisionallySavedForm(); | |
| 21 ~ProvisionallySavedForm(); | |
| 22 | |
| 23 // Sets the PasswordForm and web elements that were used in the PasswordForm | |
| 24 // update. | |
| 25 void Set(std::unique_ptr<PasswordForm> password_form, | |
| 26 const blink::WebFormElement& form_element, | |
| 27 const blink::WebInputElement& input_element); | |
| 28 // Resets the instance. | |
| 29 void Reset(); | |
|
dvadym
2017/03/14 17:11:11
Nit: comment is trivial, just remove it.
sense (YandexTeam)
2017/03/15 04:51:24
Done.
| |
| 30 | |
| 31 // Returns true if the instance has |password_form_| set, but the actual | |
| 32 // password data may be invalid (e.g. empty username or password). | |
| 33 bool IsSet() const; | |
| 34 // Returns true if |password_form_| has enough information that it is likely | |
| 35 // filled out. | |
| 36 bool IsPasswordValid() const; | |
| 37 | |
| 38 // Returns the set PasswordForm. | |
| 39 const PasswordForm& password_form() const { | |
|
dvadym
2017/03/14 17:11:11
Nit: comment is trivial, just remove it.
| |
| 40 DCHECK(IsSet()); | |
| 41 return *password_form_; | |
| 42 } | |
| 43 const blink::WebFormElement& form_element() const { return form_element_; } | |
| 44 const blink::WebInputElement& input_element() const { return input_element_; } | |
| 45 | |
| 46 private: | |
| 47 std::unique_ptr<PasswordForm> password_form_; | |
| 48 // Last used WebFormElement for the PasswordForm submission. Can be null if | |
| 49 // the form is unowned. | |
| 50 blink::WebFormElement form_element_; | |
| 51 // Last used WebInputElement which led to the PasswordForm update. Can be null | |
| 52 // if the user has performed a form submission (via a button, for example). | |
| 53 blink::WebInputElement input_element_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(ProvisionallySavedForm); | |
| 56 }; | |
| 57 | |
| 58 } // namespace autofill | |
| 59 | |
| 60 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ | |
| OLD | NEW |