Chromium Code Reviews| Index: components/autofill/content/renderer/provisionally_saved_form.h |
| diff --git a/components/autofill/content/renderer/provisionally_saved_form.h b/components/autofill/content/renderer/provisionally_saved_form.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..623e629832d4514743a8b0fd1f1fe925067ff2cd |
| --- /dev/null |
| +++ b/components/autofill/content/renderer/provisionally_saved_form.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ |
| +#define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "third_party/WebKit/public/web/WebInputElement.h" |
| + |
| +namespace autofill { |
| + |
| +struct PasswordForm; |
| + |
| +// Represents a possibly submitted password form. |
| +class ProvisionallySavedForm { |
| + public: |
| + ProvisionallySavedForm(); |
| + ~ProvisionallySavedForm(); |
| + |
| + // Sets the PasswordForm and web elements that were used in the PasswordForm |
| + // update. |
| + void Set(std::unique_ptr<PasswordForm> password_form, |
| + const blink::WebFormElement& form_element, |
| + const blink::WebInputElement& input_element); |
| + // Resets the instance. |
| + 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.
|
| + |
| + // Returns true if the instance has |password_form_| set, but the actual |
| + // password data may be invalid (e.g. empty username or password). |
| + bool IsSet() const; |
| + // Returns true if |password_form_| has enough information that it is likely |
| + // filled out. |
| + bool IsPasswordValid() const; |
| + |
| + // Returns the set PasswordForm. |
| + const PasswordForm& password_form() const { |
|
dvadym
2017/03/14 17:11:11
Nit: comment is trivial, just remove it.
|
| + DCHECK(IsSet()); |
| + return *password_form_; |
| + } |
| + const blink::WebFormElement& form_element() const { return form_element_; } |
| + const blink::WebInputElement& input_element() const { return input_element_; } |
| + |
| + private: |
| + std::unique_ptr<PasswordForm> password_form_; |
| + // Last used WebFormElement for the PasswordForm submission. Can be null if |
| + // the form is unowned. |
| + blink::WebFormElement form_element_; |
| + // Last used WebInputElement which led to the PasswordForm update. Can be null |
| + // if the user has performed a form submission (via a button, for example). |
| + blink::WebInputElement input_element_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ProvisionallySavedForm); |
| +}; |
| + |
| +} // namespace autofill |
| + |
| +#endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_FORM_H_ |