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

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: Unfriend PasswordAutofillAgentTest and RequestAutocompleteRendererTest from AutofillAgent. 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(
vabr (Chromium) 2014/09/15 14:26:59 No need to expose this, it is already public throu
Pritam Nikam 2014/09/16 07:54:20 AutofillAgent overrides this function. As per curr
vabr (Chromium) 2014/09/18 09:29:18 It should not matter how AutofillAgent changes the
61 const blink::WebFormControlElement& element,
62 bool was_focused) OVERRIDE;
63
64 // blink::WebAutofillClient:
65 virtual void textFieldDidEndEditing(const blink::WebInputElement& element);
vabr (Chromium) 2014/09/15 14:26:59 Also the WebAutofillClient methods are already pub
Pritam Nikam 2014/09/16 07:54:20 Ditto.
66 virtual void textFieldDidChange(const blink::WebFormControlElement& element);
67 virtual void textFieldDidReceiveKeyDown(const blink::WebInputElement& element,
68 const blink::WebKeyboardEvent& event);
69 virtual void didRequestAutocomplete(const blink::WebFormElement& form);
70
71 virtual void OnFillPasswordSuggestion(const base::string16& username,
72 const base::string16& password);
73
74 // Called when interactive autocomplete finishes. |message| is printed to
75 // the console if non-empty.
76 virtual void OnRequestAutocompleteResult(
77 blink::WebFormElement::AutocompleteResult result,
78 const base::string16& message,
79 const FormData& form_data);
80
58 private: 81 private:
59 // content::RenderViewObserver: 82 // content::RenderViewObserver:
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 83 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE; 84 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE;
62 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, 85 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
63 bool is_new_navigation) OVERRIDE; 86 bool is_new_navigation) OVERRIDE;
64 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; 87 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE;
65 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; 88 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE;
66 virtual void WillSubmitForm(blink::WebLocalFrame* frame, 89 virtual void WillSubmitForm(blink::WebLocalFrame* frame,
67 const blink::WebFormElement& form) OVERRIDE; 90 const blink::WebFormElement& form) OVERRIDE;
68 virtual void DidChangeScrollOffset(blink::WebLocalFrame* frame) OVERRIDE; 91 virtual void DidChangeScrollOffset(blink::WebLocalFrame* frame) OVERRIDE;
69 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE; 92 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE;
70 virtual void OrientationChangeEvent() OVERRIDE; 93 virtual void OrientationChangeEvent() OVERRIDE;
71 virtual void Resized() OVERRIDE; 94 virtual void Resized() OVERRIDE;
72 95
73 // PageClickListener:
74 virtual void FormControlElementClicked(
75 const blink::WebFormControlElement& element,
76 bool was_focused) OVERRIDE;
77
78 // blink::WebAutofillClient: 96 // blink::WebAutofillClient:
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); 97 virtual void setIgnoreTextChanges(bool ignore);
89 virtual void didAssociateFormControls( 98 virtual void didAssociateFormControls(
90 const blink::WebVector<blink::WebNode>& nodes); 99 const blink::WebVector<blink::WebNode>& nodes);
91 virtual void openTextDataListChooser(const blink::WebInputElement& element); 100 virtual void openTextDataListChooser(const blink::WebInputElement& element);
92 virtual void firstUserGestureObserved(); 101 virtual void firstUserGestureObserved();
93 102
94 void OnFieldTypePredictionsAvailable( 103 void OnFieldTypePredictionsAvailable(
95 const std::vector<FormDataPredictions>& forms); 104 const std::vector<FormDataPredictions>& forms);
96 void OnFillForm(int query_id, const FormData& form); 105 void OnFillForm(int query_id, const FormData& form);
97 void OnPing(); 106 void OnPing();
98 void OnPreviewForm(int query_id, const FormData& form); 107 void OnPreviewForm(int query_id, const FormData& form);
99 108
100 // For external Autofill selection. 109 // For external Autofill selection.
101 void OnClearForm(); 110 void OnClearForm();
102 void OnClearPreviewedForm(); 111 void OnClearPreviewedForm();
103 void OnFillFieldWithValue(const base::string16& value); 112 void OnFillFieldWithValue(const base::string16& value);
104 void OnPreviewFieldWithValue(const base::string16& value); 113 void OnPreviewFieldWithValue(const base::string16& value);
105 void OnAcceptDataListSuggestion(const base::string16& value); 114 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, 115 void OnPreviewPasswordSuggestion(const base::string16& username,
109 const base::string16& password); 116 const base::string16& password);
110 117
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|. 118 // Called when an autocomplete request succeeds or fails with the |result|.
119 void FinishAutocompleteRequest( 119 void FinishAutocompleteRequest(
120 blink::WebFormElement::AutocompleteResult result); 120 blink::WebFormElement::AutocompleteResult result);
121 121
122 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug 122 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
123 // http://bugs.webkit.org/show_bug.cgi?id=16976 123 // http://bugs.webkit.org/show_bug.cgi?id=16976
124 void TextFieldDidChangeImpl(const blink::WebFormControlElement& element); 124 void TextFieldDidChangeImpl(const blink::WebFormControlElement& element);
125 125
126 // Shows the autofill suggestions for |element|. 126 // Shows the autofill suggestions for |element|.
127 // This call is asynchronous and may or may not lead to the showing of a 127 // 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. 223 // messages to close the Autofill popup when it can't possibly be showing.
224 bool is_popup_possibly_visible_; 224 bool is_popup_possibly_visible_;
225 225
226 // True if a message has already been sent about forms for the main frame. 226 // 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 227 // 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. 228 // exist in the frame. Otherwise, such messages are supressed.
229 bool main_frame_processed_; 229 bool main_frame_processed_;
230 230
231 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; 231 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
232 232
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); 233 DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
253 }; 234 };
254 235
255 } // namespace autofill 236 } // namespace autofill
256 237
257 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ 238 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698