| Index: components/autofill/content/renderer/provisionally_saved_password_form.h
|
| diff --git a/components/autofill/content/renderer/provisionally_saved_password_form.h b/components/autofill/content/renderer/provisionally_saved_password_form.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..318eb189aedac95a6e3a9b74f690af167715fd7a
|
| --- /dev/null
|
| +++ b/components/autofill/content/renderer/provisionally_saved_password_form.h
|
| @@ -0,0 +1,58 @@
|
| +// 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_PASSWORD_FORM_H_
|
| +#define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_PASSWORD_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 ProvisionallySavedPasswordForm {
|
| + public:
|
| + ProvisionallySavedPasswordForm();
|
| + ~ProvisionallySavedPasswordForm();
|
| +
|
| + // 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);
|
| + void Reset();
|
| +
|
| + // 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;
|
| +
|
| + const PasswordForm& password_form() const {
|
| + 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(ProvisionallySavedPasswordForm);
|
| +};
|
| +
|
| +} // namespace autofill
|
| +
|
| +#endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_PASSWORD_FORM_H_
|
|
|