Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: components/autofill/content/renderer/provisionally_saved_password_form.h

Issue 2746033004: Add password form search using blink::WebNode reference comparison. (Closed)
Patch Set: Rename ProvisionallySavedForm to ProvisionallySavedPasswordForm. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_PASSWORD_FORM_H _
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_PASSWORD_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 ProvisionallySavedPasswordForm {
19 public:
20 ProvisionallySavedPasswordForm();
21 ~ProvisionallySavedPasswordForm();
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 void Reset();
29
30 // Returns true if the instance has |password_form_| set, but the actual
31 // password data may be invalid (e.g. empty username or password).
32 bool IsSet() const;
33 // Returns true if |password_form_| has enough information that it is likely
34 // filled out.
35 bool IsPasswordValid() const;
36
37 const PasswordForm& password_form() const {
38 DCHECK(IsSet());
39 return *password_form_;
40 }
41 const blink::WebFormElement& form_element() const { return form_element_; }
42 const blink::WebInputElement& input_element() const { return input_element_; }
43
44 private:
45 std::unique_ptr<PasswordForm> password_form_;
46 // Last used WebFormElement for the PasswordForm submission. Can be null if
47 // the form is unowned.
48 blink::WebFormElement form_element_;
49 // Last used WebInputElement which led to the PasswordForm update. Can be null
50 // if the user has performed a form submission (via a button, for example).
51 blink::WebInputElement input_element_;
52
53 DISALLOW_COPY_AND_ASSIGN(ProvisionallySavedPasswordForm);
54 };
55
56 } // namespace autofill
57
58 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PROVISIONALLY_SAVED_PASSWORD_FOR M_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698