Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 20 matching lines...) Expand all Loading... | |
| 31 struct FormFieldData; | 31 struct FormFieldData; |
| 32 struct WebElementDescriptor; | 32 struct WebElementDescriptor; |
| 33 class PasswordAutofillAgent; | 33 class PasswordAutofillAgent; |
| 34 class PasswordGenerationAgent; | 34 class PasswordGenerationAgent; |
| 35 | 35 |
| 36 // AutofillAgent deals with Autofill related communications between WebKit and | 36 // AutofillAgent deals with Autofill related communications between WebKit and |
| 37 // the browser. There is one AutofillAgent per RenderView. | 37 // the browser. There is one AutofillAgent per RenderView. |
| 38 // This code was originally part of RenderView. | 38 // This code was originally part of RenderView. |
| 39 // Note that Autofill encompasses: | 39 // Note that Autofill encompasses: |
| 40 // - single text field suggestions, that we usually refer to as Autocomplete, | 40 // - single text field suggestions, that we usually refer to as Autocomplete, |
| 41 // - password form fill, refered to as Password Autofill, and | 41 // - password form fill, referred to as Password Autofill, and |
| 42 // - entire form fill based on one field entry, referred to as Form Autofill. | 42 // - entire form fill based on one field entry, referred to as Form Autofill. |
| 43 | 43 |
| 44 class AutofillAgent : public content::RenderViewObserver, | 44 class AutofillAgent : public content::RenderViewObserver, |
| 45 public PageClickListener, | 45 public PageClickListener, |
| 46 public blink::WebAutofillClient { | 46 public blink::WebAutofillClient { |
| 47 public: | 47 public: |
| 48 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent. | 48 // PasswordAutofillAgent is guaranteed to outlive AutofillAgent. |
| 49 // PasswordGenerationAgent may be NULL. If it is not, then it is also | 49 // PasswordGenerationAgent may be NULL. If it is not, then it is also |
| 50 // guaranteed to outlive AutofillAgent. | 50 // guaranteed to outlive AutofillAgent. |
| 51 AutofillAgent(content::RenderView* render_view, | 51 AutofillAgent(content::RenderView* render_view, |
| 52 PasswordAutofillAgent* password_autofill_manager, | 52 PasswordAutofillAgent* password_autofill_manager, |
| 53 PasswordGenerationAgent* password_generation_agent); | 53 PasswordGenerationAgent* password_generation_agent); |
| 54 virtual ~AutofillAgent(); | 54 virtual ~AutofillAgent(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // content::RenderViewObserver: | 57 // content::RenderViewObserver: |
| 58 bool OnMessageReceived(const IPC::Message& message) override; | 58 bool OnMessageReceived(const IPC::Message& message) override; |
| 59 void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override; | 59 void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override; |
| 60 void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, | 60 void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, |
| 61 bool is_new_navigation) override; | 61 bool is_new_navigation) override; |
| 62 void FrameDetached(blink::WebFrame* frame) override; | 62 void FrameDetached(blink::WebFrame* frame) override; |
| 63 void FrameWillClose(blink::WebFrame* frame) override; | 63 void FrameWillClose(blink::WebFrame* frame) override; |
| 64 void WillSubmitForm(blink::WebLocalFrame* frame, | 64 void WillSubmitForm(blink::WebLocalFrame* frame, |
| 65 const blink::WebFormElement& form) override; | 65 const blink::WebFormElement& form) override; |
| 66 void DidChangeScrollOffset(blink::WebLocalFrame* frame) override; | 66 void DidChangeScrollOffset(blink::WebLocalFrame* frame) override; |
| 67 void FocusedNodeChanged(const blink::WebNode& node) override; | 67 void FocusedNodeChanged(const blink::WebNode& node) override; |
| 68 void WillAnimatePageScale(bool will_animate) override; | |
|
aelias_OOO_until_Jul13
2014/11/22 03:38:11
FocusChangeComplete(bool will_animate) would be a
| |
| 68 void OrientationChangeEvent() override; | 69 void OrientationChangeEvent() override; |
| 69 void Resized() override; | 70 void Resized() override; |
| 71 void DidCompletePageScaleAnimation() override; | |
| 70 | 72 |
| 71 // PageClickListener: | 73 // PageClickListener: |
| 72 void FormControlElementClicked(const blink::WebFormControlElement& element, | 74 void FormControlElementClicked(const blink::WebFormControlElement& element, |
| 73 bool was_focused) override; | 75 bool was_focused) override; |
| 74 | 76 |
| 75 // blink::WebAutofillClient: | 77 // blink::WebAutofillClient: |
| 76 virtual void textFieldDidEndEditing( | 78 virtual void textFieldDidEndEditing( |
| 77 const blink::WebInputElement& element); | 79 const blink::WebInputElement& element); |
| 78 virtual void textFieldDidChange( | 80 virtual void textFieldDidChange( |
| 79 const blink::WebFormControlElement& element); | 81 const blink::WebFormControlElement& element); |
| 80 virtual void textFieldDidReceiveKeyDown( | 82 virtual void textFieldDidReceiveKeyDown( |
| 81 const blink::WebInputElement& element, | 83 const blink::WebInputElement& element, |
| 82 const blink::WebKeyboardEvent& event); | 84 const blink::WebKeyboardEvent& event); |
| 83 virtual void didRequestAutocomplete( | 85 virtual void didRequestAutocomplete( |
| 84 const blink::WebFormElement& form); | 86 const blink::WebFormElement& form); |
| 85 virtual void setIgnoreTextChanges(bool ignore); | 87 virtual void setIgnoreTextChanges(bool ignore); |
| 86 virtual void didAssociateFormControls( | 88 virtual void didAssociateFormControls( |
| 87 const blink::WebVector<blink::WebNode>& nodes); | 89 const blink::WebVector<blink::WebNode>& nodes); |
| 88 virtual void openTextDataListChooser(const blink::WebInputElement& element); | 90 virtual void openTextDataListChooser(const blink::WebInputElement& element); |
| 89 virtual void firstUserGestureObserved(); | 91 virtual void firstUserGestureObserved(); |
| 90 | 92 |
| 91 void OnFieldTypePredictionsAvailable( | 93 void OnFieldTypePredictionsAvailable( |
| 92 const std::vector<FormDataPredictions>& forms); | 94 const std::vector<FormDataPredictions>& forms); |
| 93 void OnFillForm(int query_id, const FormData& form); | 95 void OnFillForm(int query_id, const FormData& form); |
| 94 void OnPing(); | 96 void OnPing(); |
| 95 void OnPreviewForm(int query_id, const FormData& form); | 97 void OnPreviewForm(int query_id, const FormData& form); |
| 96 | 98 |
| 99 // Called when page scale animation is completed or cancelled. | |
| 100 void OnAnimationCompleted(); | |
| 101 | |
| 102 // Called when page scale animation is completed after |element| was clicked. | |
| 103 void OnAnimationCompletedAfterFormControlElementClicked( | |
| 104 const blink::WebFormControlElement& element, | |
| 105 bool was_focused); | |
| 106 | |
| 107 // Called when page scale animation is completed after |node| was focused. | |
| 108 void OnAnimationCompletedAfterFocusedNodeChanged(const blink::WebNode& node); | |
| 109 | |
| 97 // For external Autofill selection. | 110 // For external Autofill selection. |
| 98 void OnClearForm(); | 111 void OnClearForm(); |
| 99 void OnClearPreviewedForm(); | 112 void OnClearPreviewedForm(); |
| 100 void OnFillFieldWithValue(const base::string16& value); | 113 void OnFillFieldWithValue(const base::string16& value); |
| 101 void OnPreviewFieldWithValue(const base::string16& value); | 114 void OnPreviewFieldWithValue(const base::string16& value); |
| 102 void OnAcceptDataListSuggestion(const base::string16& value); | 115 void OnAcceptDataListSuggestion(const base::string16& value); |
| 103 void OnFillPasswordSuggestion(const base::string16& username, | 116 void OnFillPasswordSuggestion(const base::string16& username, |
| 104 const base::string16& password); | 117 const base::string16& password); |
| 105 void OnPreviewPasswordSuggestion(const base::string16& username, | 118 void OnPreviewPasswordSuggestion(const base::string16& username, |
| 106 const base::string16& password); | 119 const base::string16& password); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // trigger an autofill popup to show. | 228 // trigger an autofill popup to show. |
| 216 bool ignore_text_changes_; | 229 bool ignore_text_changes_; |
| 217 | 230 |
| 218 // Whether the Autofill popup is possibly visible. This is tracked as a | 231 // Whether the Autofill popup is possibly visible. This is tracked as a |
| 219 // performance improvement, so that the IPC channel isn't flooded with | 232 // performance improvement, so that the IPC channel isn't flooded with |
| 220 // messages to close the Autofill popup when it can't possibly be showing. | 233 // messages to close the Autofill popup when it can't possibly be showing. |
| 221 bool is_popup_possibly_visible_; | 234 bool is_popup_possibly_visible_; |
| 222 | 235 |
| 223 // True if a message has already been sent about forms for the main frame. | 236 // True if a message has already been sent about forms for the main frame. |
| 224 // When the main frame is first loaded, a message is sent even if no forms | 237 // When the main frame is first loaded, a message is sent even if no forms |
| 225 // exist in the frame. Otherwise, such messages are supressed. | 238 // exist in the frame. Otherwise, such messages are suppressed. |
| 226 bool main_frame_processed_; | 239 bool main_frame_processed_; |
| 227 | 240 |
| 241 // The form control element for which the click event handler has been | |
| 242 // suppressed until page scale animation is complete. | |
| 243 blink::WebFormControlElement clicked_form_control_element_; | |
| 244 | |
| 245 // Whether |clicked_form_control_element_| was focused when it was clicked. | |
| 246 bool clicked_form_control_element_was_focused_; | |
| 247 | |
| 248 // The node for which the focus changed event handler has been suppressed | |
| 249 // until page scale animation is complete. | |
| 250 blink::WebNode changed_focused_node_; | |
| 251 | |
| 228 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; | 252 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; |
| 229 | 253 |
| 230 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 254 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 231 }; | 255 }; |
| 232 | 256 |
| 233 } // namespace autofill | 257 } // namespace autofill |
| 234 | 258 |
| 235 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 259 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
| OLD | NEW |