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

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

Issue 563313004: [Password Manager] Unfriend PasswordAutofillAgentTest from PasswordAutofillAgent (clean-up). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated review comments. Created 6 years, 3 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_AUTOFILL_AGENT_H_ 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public blink::WebAutofillClient { 48 public blink::WebAutofillClient {
49 public: 49 public:
50 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent. 50 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent.
51 // PasswordGenerationAgent may be NULL. If it is not, then it is also 51 // PasswordGenerationAgent may be NULL. If it is not, then it is also
52 // guaranteed to outlive AutofillAgent. 52 // guaranteed to outlive AutofillAgent.
53 AutofillAgent(content::RenderView* render_view, 53 AutofillAgent(content::RenderView* render_view,
54 PasswordAutofillAgent* password_autofill_manager, 54 PasswordAutofillAgent* password_autofill_manager,
55 PasswordGenerationAgent* password_generation_agent); 55 PasswordGenerationAgent* password_generation_agent);
56 virtual ~AutofillAgent(); 56 virtual ~AutofillAgent();
57 57
58 protected:
59 // PageClickListener:
60 virtual void FormControlElementClicked(
61 const blink::WebFormControlElement& element,
62 bool was_focused) OVERRIDE;
63
64 // blink::WebAutofillClient:
65 virtual void textFieldDidEndEditing(
66 const blink::WebInputElement& element) OVERRIDE;
67 virtual void textFieldDidChange(
68 const blink::WebFormControlElement& element) OVERRIDE;
69 virtual void textFieldDidReceiveKeyDown(
70 const blink::WebInputElement& element,
71 const blink::WebKeyboardEvent& event) OVERRIDE;
72 virtual void didRequestAutocomplete(
73 const blink::WebFormElement& form) OVERRIDE;
74
75 virtual void OnFillPasswordSuggestion(const base::string16& username,
76 const base::string16& password);
Ilya Sherman 2014/09/18 18:45:53 Please modify the test to simulate sending an IPC
Pritam Nikam 2014/09/19 11:08:03 Done.
77
78 // Called when interactive autocomplete finishes. |message| is printed to
79 // the console if non-empty.
80 virtual void OnRequestAutocompleteResult(
81 blink::WebFormElement::AutocompleteResult result,
82 const base::string16& message,
83 const FormData& form_data);
Ilya Sherman 2014/09/18 18:45:52 Ditto.
Pritam Nikam 2014/09/19 11:08:03 Done.
84
58 private: 85 private:
59 // content::RenderViewObserver: 86 // content::RenderViewObserver:
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 87 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE; 88 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE;
62 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, 89 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
63 bool is_new_navigation) OVERRIDE; 90 bool is_new_navigation) OVERRIDE;
64 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; 91 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE;
65 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; 92 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE;
66 virtual void WillSubmitForm(blink::WebLocalFrame* frame, 93 virtual void WillSubmitForm(blink::WebLocalFrame* frame,
67 const blink::WebFormElement& form) OVERRIDE; 94 const blink::WebFormElement& form) OVERRIDE;
68 virtual void DidChangeScrollOffset(blink::WebLocalFrame* frame) OVERRIDE; 95 virtual void DidChangeScrollOffset(blink::WebLocalFrame* frame) OVERRIDE;
69 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE; 96 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE;
70 virtual void OrientationChangeEvent() OVERRIDE; 97 virtual void OrientationChangeEvent() OVERRIDE;
71 virtual void Resized() OVERRIDE; 98 virtual void Resized() OVERRIDE;
72 99
73 // PageClickListener:
74 virtual void FormControlElementClicked(
75 const blink::WebFormControlElement& element,
76 bool was_focused) OVERRIDE;
77
78 // blink::WebAutofillClient: 100 // blink::WebAutofillClient:
Ilya Sherman 2014/09/18 18:45:52 If you move some of the methods in this group to h
Pritam Nikam 2014/09/19 11:08:03 Done.
79 virtual void textFieldDidEndEditing(
80 const blink::WebInputElement& element);
81 virtual void textFieldDidChange(
82 const blink::WebFormControlElement& element);
83 virtual void textFieldDidReceiveKeyDown(
84 const blink::WebInputElement& element,
85 const blink::WebKeyboardEvent& event);
86 virtual void didRequestAutocomplete(
87 const blink::WebFormElement& form);
88 virtual void setIgnoreTextChanges(bool ignore); 101 virtual void setIgnoreTextChanges(bool ignore);
89 virtual void didAssociateFormControls( 102 virtual void didAssociateFormControls(
90 const blink::WebVector<blink::WebNode>& nodes); 103 const blink::WebVector<blink::WebNode>& nodes);
91 virtual void openTextDataListChooser(const blink::WebInputElement& element); 104 virtual void openTextDataListChooser(const blink::WebInputElement& element);
92 virtual void firstUserGestureObserved(); 105 virtual void firstUserGestureObserved();
93 106
94 void OnFieldTypePredictionsAvailable( 107 void OnFieldTypePredictionsAvailable(
95 const std::vector<FormDataPredictions>& forms); 108 const std::vector<FormDataPredictions>& forms);
96 void OnFillForm(int query_id, const FormData& form); 109 void OnFillForm(int query_id, const FormData& form);
97 void OnPing(); 110 void OnPing();
98 void OnPreviewForm(int query_id, const FormData& form); 111 void OnPreviewForm(int query_id, const FormData& form);
99 112
100 // For external Autofill selection. 113 // For external Autofill selection.
101 void OnClearForm(); 114 void OnClearForm();
102 void OnClearPreviewedForm(); 115 void OnClearPreviewedForm();
103 void OnFillFieldWithValue(const base::string16& value); 116 void OnFillFieldWithValue(const base::string16& value);
104 void OnPreviewFieldWithValue(const base::string16& value); 117 void OnPreviewFieldWithValue(const base::string16& value);
105 void OnAcceptDataListSuggestion(const base::string16& value); 118 void OnAcceptDataListSuggestion(const base::string16& value);
106 void OnFillPasswordSuggestion(const base::string16& username,
107 const base::string16& password);
108 void OnPreviewPasswordSuggestion(const base::string16& username, 119 void OnPreviewPasswordSuggestion(const base::string16& username,
109 const base::string16& password); 120 const base::string16& password);
110 121
111 // Called when interactive autocomplete finishes. |message| is printed to
112 // the console if non-empty.
113 void OnRequestAutocompleteResult(
114 blink::WebFormElement::AutocompleteResult result,
115 const base::string16& message,
116 const FormData& form_data);
117
118 // Called when an autocomplete request succeeds or fails with the |result|. 122 // Called when an autocomplete request succeeds or fails with the |result|.
119 void FinishAutocompleteRequest( 123 void FinishAutocompleteRequest(
120 blink::WebFormElement::AutocompleteResult result); 124 blink::WebFormElement::AutocompleteResult result);
121 125
122 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug 126 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
123 // http://bugs.webkit.org/show_bug.cgi?id=16976 127 // http://bugs.webkit.org/show_bug.cgi?id=16976
124 void TextFieldDidChangeImpl(const blink::WebFormControlElement& element); 128 void TextFieldDidChangeImpl(const blink::WebFormControlElement& element);
125 129
126 // Shows the autofill suggestions for |element|. 130 // Shows the autofill suggestions for |element|.
127 // This call is asynchronous and may or may not lead to the showing of a 131 // This call is asynchronous and may or may not lead to the showing of a
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // messages to close the Autofill popup when it can't possibly be showing. 227 // messages to close the Autofill popup when it can't possibly be showing.
224 bool is_popup_possibly_visible_; 228 bool is_popup_possibly_visible_;
225 229
226 // True if a message has already been sent about forms for the main frame. 230 // True if a message has already been sent about forms for the main frame.
227 // When the main frame is first loaded, a message is sent even if no forms 231 // When the main frame is first loaded, a message is sent even if no forms
228 // exist in the frame. Otherwise, such messages are supressed. 232 // exist in the frame. Otherwise, such messages are supressed.
229 bool main_frame_processed_; 233 bool main_frame_processed_;
230 234
231 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; 235 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
232 236
233 friend class PasswordAutofillAgentTest;
234 friend class RequestAutocompleteRendererTest;
235 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, FillFormElement);
236 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, SendDynamicForms);
237 FRIEND_TEST_ALL_PREFIXES(AutofillRendererTest, ShowAutofillWarning);
238 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, WaitUsername);
239 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionAccept);
240 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, SuggestionSelect);
241 FRIEND_TEST_ALL_PREFIXES(
242 PasswordAutofillAgentTest,
243 PasswordAutofillTriggersOnChangeEventsWaitForUsername);
244 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillAgentTest, CredentialsOnClick);
245 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest,
246 NoCancelOnMainFrameNavigateAfterDone);
247 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest,
248 NoCancelOnSubframeNavigateAfterDone);
249 FRIEND_TEST_ALL_PREFIXES(RequestAutocompleteRendererTest,
250 InvokingTwiceOnlyShowsOnce);
251
252 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); 237 DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
253 }; 238 };
254 239
255 } // namespace autofill 240 } // namespace autofill
256 241
257 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 242 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698