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_PASSWORD_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/autofill/core/common/password_form_fill_data.h" | 13 #include "components/autofill/core/common/password_form_fill_data.h" |
| 14 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_view_observer.h" |
| 15 #include "third_party/WebKit/public/web/WebInputElement.h" | 15 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 16 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 class WebInputElement; | 19 class WebInputElement; |
| 19 class WebKeyboardEvent; | 20 class WebKeyboardEvent; |
| 20 class WebSecurityOrigin; | 21 class WebSecurityOrigin; |
| 21 class WebView; | 22 class WebView; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace autofill { | 25 namespace autofill { |
| 25 | 26 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 struct PasswordInfo { | 73 struct PasswordInfo { |
| 73 blink::WebInputElement password_field; | 74 blink::WebInputElement password_field; |
| 74 PasswordFormFillData fill_data; | 75 PasswordFormFillData fill_data; |
| 75 bool backspace_pressed_last; | 76 bool backspace_pressed_last; |
| 76 PasswordInfo() : backspace_pressed_last(false) {} | 77 PasswordInfo() : backspace_pressed_last(false) {} |
| 77 }; | 78 }; |
| 78 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 79 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
| 79 typedef std::map<blink::WebFrame*, | 80 typedef std::map<blink::WebFrame*, |
| 80 linked_ptr<PasswordForm> > FrameToPasswordFormMap; | 81 linked_ptr<PasswordForm> > FrameToPasswordFormMap; |
| 81 | 82 |
| 83 class AutofillWebUserGestureHandler : public blink::WebUserGestureHandler { | |
| 84 public: | |
| 85 AutofillWebUserGestureHandler(PasswordAutofillAgent* agent); | |
| 86 virtual ~AutofillWebUserGestureHandler(); | |
| 87 | |
| 88 void addElement(blink::WebInputElement* element) { | |
| 89 elements_.push_back(element); | |
| 90 } | |
| 91 | |
| 92 virtual void onGesture(); | |
| 93 | |
| 94 private: | |
| 95 PasswordAutofillAgent* agent_; | |
| 96 std::vector<blink::WebInputElement*> elements_; | |
| 97 }; | |
| 98 | |
| 82 // RenderViewObserver: | 99 // RenderViewObserver: |
| 83 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 100 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 84 virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE; | 101 virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE; |
| 85 virtual void DidStartLoading() OVERRIDE; | 102 virtual void DidStartLoading() OVERRIDE; |
| 86 virtual void DidFinishDocumentLoad(blink::WebFrame* frame) OVERRIDE; | 103 virtual void DidFinishDocumentLoad(blink::WebFrame* frame) OVERRIDE; |
| 87 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE; | 104 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE; |
| 88 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; | 105 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; |
| 89 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; | 106 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; |
| 90 virtual void WillSendSubmitEvent(blink::WebFrame* frame, | 107 virtual void WillSendSubmitEvent(blink::WebFrame* frame, |
| 91 const blink::WebFormElement& form) OVERRIDE; | 108 const blink::WebFormElement& form) OVERRIDE; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // Finds login information for a |node| that was previously filled. | 154 // Finds login information for a |node| that was previously filled. |
| 138 bool FindLoginInfo(const blink::WebNode& node, | 155 bool FindLoginInfo(const blink::WebNode& node, |
| 139 blink::WebInputElement* found_input, | 156 blink::WebInputElement* found_input, |
| 140 PasswordInfo* found_password); | 157 PasswordInfo* found_password); |
| 141 | 158 |
| 142 // If |provisionally_saved_forms_| contains a form for |current_frame| or its | 159 // If |provisionally_saved_forms_| contains a form for |current_frame| or its |
| 143 // children, return such frame. | 160 // children, return such frame. |
| 144 blink::WebFrame* CurrentOrChildFrameWithSavedForms( | 161 blink::WebFrame* CurrentOrChildFrameWithSavedForms( |
| 145 const blink::WebFrame* current_frame); | 162 const blink::WebFrame* current_frame); |
| 146 | 163 |
| 164 void setUserGestureOccurred(bool occurred) { | |
|
Garrett Casto
2013/12/02 23:49:12
Inline functions like this are generally also done
jww
2013/12/03 06:29:59
Done.
| |
| 165 userGestureOccurred_ = occurred; | |
| 166 } | |
| 167 | |
| 147 // The logins we have filled so far with their associated info. | 168 // The logins we have filled so far with their associated info. |
| 148 LoginToPasswordInfoMap login_to_password_info_; | 169 LoginToPasswordInfoMap login_to_password_info_; |
| 149 | 170 |
| 150 // Used for UMA stats. | 171 // Used for UMA stats. |
| 151 OtherPossibleUsernamesUsage usernames_usage_; | 172 OtherPossibleUsernamesUsage usernames_usage_; |
| 152 | 173 |
| 153 // Pointer to the WebView. Used to access page scale factor. | 174 // Pointer to the WebView. Used to access page scale factor. |
| 154 blink::WebView* web_view_; | 175 blink::WebView* web_view_; |
| 155 | 176 |
| 156 // Set if the user might be submitting a password form on the current page, | 177 // Set if the user might be submitting a password form on the current page, |
| 157 // but the submit may still fail (i.e. doesn't pass JavaScript validation). | 178 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
| 158 FrameToPasswordFormMap provisionally_saved_forms_; | 179 FrameToPasswordFormMap provisionally_saved_forms_; |
| 159 | 180 |
| 160 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 181 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
|
Garrett Casto
2013/12/02 23:49:12
WeakPtrFactory should always be the last member va
jww
2013/12/03 06:29:59
Done.
| |
| 161 | 182 |
| 183 AutofillWebUserGestureHandler* gestureHandler_; | |
|
Garrett Casto
2013/12/02 23:49:12
These should be unix_hacker_style_ not mixedCase_.
jww
2013/12/03 06:29:59
Done.
| |
| 184 | |
| 185 bool userGestureOccurred_; | |
| 186 | |
| 162 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 187 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 163 }; | 188 }; |
| 164 | 189 |
| 165 } // namespace autofill | 190 } // namespace autofill |
| 166 | 191 |
| 167 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 192 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |