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

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

Issue 662493002: [Password Generation] Enable generation for dynamically created forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 years, 2 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
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_PASSWORD_GENERATION_AGENT_H_ 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 explicit PasswordGenerationAgent(content::RenderView* render_view); 32 explicit PasswordGenerationAgent(content::RenderView* render_view);
33 virtual ~PasswordGenerationAgent(); 33 virtual ~PasswordGenerationAgent();
34 34
35 // Returns true if the field being changed is one where a generated password 35 // Returns true if the field being changed is one where a generated password
36 // is being offered. Updates the state of the popup if necessary. 36 // is being offered. Updates the state of the popup if necessary.
37 bool TextDidChangeInTextField(const blink::WebInputElement& element); 37 bool TextDidChangeInTextField(const blink::WebInputElement& element);
38 38
39 // Returns true if the newly focused node caused the generation UI to show. 39 // Returns true if the newly focused node caused the generation UI to show.
40 bool FocusedNodeHasChanged(const blink::WebNode& node); 40 bool FocusedNodeHasChanged(const blink::WebNode& node);
41 41
42 // Called when new form controls are inserted.
43 void OnDynamicFormsSeen(blink::WebLocalFrame* frame);
44
42 // The length that a password can be before the UI is hidden. 45 // The length that a password can be before the UI is hidden.
43 static const size_t kMaximumOfferSize = 5; 46 static const size_t kMaximumOfferSize = 5;
44 47
45 protected: 48 protected:
46 // Returns true if this document is one that we should consider analyzing. 49 // Returns true if this document is one that we should consider analyzing.
47 // Virtual so that it can be overriden during testing. 50 // Virtual so that it can be overriden during testing.
48 virtual bool ShouldAnalyzeDocument(const blink::WebDocument& document) const; 51 virtual bool ShouldAnalyzeDocument(const blink::WebDocument& document) const;
49 52
50 // RenderViewObserver: 53 // RenderViewObserver:
51 virtual bool OnMessageReceived(const IPC::Message& message) override; 54 virtual bool OnMessageReceived(const IPC::Message& message) override;
52 55
53 // Use to force enable during testing. 56 // Use to force enable during testing.
54 void set_enabled(bool enabled) { enabled_ = enabled; } 57 void set_enabled(bool enabled) { enabled_ = enabled; }
55 58
56 private: 59 private:
57 // RenderViewObserver: 60 // RenderViewObserver:
58 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override; 61 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override;
59 virtual void DidFinishLoad(blink::WebLocalFrame* frame) override; 62 virtual void DidFinishLoad(blink::WebLocalFrame* frame) override;
60 63
61 // Message handlers. 64 // Message handlers.
62 void OnFormNotBlacklisted(const PasswordForm& form); 65 void OnFormNotBlacklisted(const PasswordForm& form);
63 void OnPasswordAccepted(const base::string16& password); 66 void OnPasswordAccepted(const base::string16& password);
64 void OnAccountCreationFormsDetected( 67 void OnAccountCreationFormsDetected(
65 const std::vector<autofill::FormData>& forms); 68 const std::vector<autofill::FormData>& forms);
66 69
70 // Helper function that will try and populate |password_elements_| and
71 // |possible_account_creation_form_|.
72 void FindPossibleGenerationForm(blink::WebLocalFrame* frame);
73
67 // Helper function to decide if |passwords_| contains password fields for 74 // Helper function to decide if |passwords_| contains password fields for
68 // an account creation form. Sets |generation_element_| to the field that 75 // an account creation form. Sets |generation_element_| to the field that
69 // we want to trigger the generation UI on. 76 // we want to trigger the generation UI on.
70 void DetermineGenerationElement(); 77 void DetermineGenerationElement();
71 78
72 // Show password generation UI anchored at |generation_element_|. 79 // Show password generation UI anchored at |generation_element_|.
73 void ShowGenerationPopup(); 80 void ShowGenerationPopup();
74 81
75 // Show UI for editing a generated password at |generation_element_|. 82 // Show UI for editing a generated password at |generation_element_|.
76 void ShowEditingPopup(); 83 void ShowEditingPopup();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 126
120 // If this feature is enabled. Controlled by Finch. 127 // If this feature is enabled. Controlled by Finch.
121 bool enabled_; 128 bool enabled_;
122 129
123 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); 130 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent);
124 }; 131 };
125 132
126 } // namespace autofill 133 } // namespace autofill
127 134
128 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ 135 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698