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/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "components/autofill/core/common/password_form_fill_data.h" | 13 #include "components/autofill/core/common/password_form_fill_data.h" |
13 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_view_observer.h" |
14 #include "third_party/WebKit/public/web/WebInputElement.h" | 15 #include "third_party/WebKit/public/web/WebInputElement.h" |
15 | 16 |
16 namespace WebKit { | 17 namespace WebKit { |
17 class WebInputElement; | 18 class WebInputElement; |
18 class WebKeyboardEvent; | 19 class WebKeyboardEvent; |
19 class WebView; | 20 class WebView; |
20 } | 21 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 OTHER_POSSIBLE_USERNAMES_MAX | 61 OTHER_POSSIBLE_USERNAMES_MAX |
61 }; | 62 }; |
62 | 63 |
63 struct PasswordInfo { | 64 struct PasswordInfo { |
64 WebKit::WebInputElement password_field; | 65 WebKit::WebInputElement password_field; |
65 PasswordFormFillData fill_data; | 66 PasswordFormFillData fill_data; |
66 bool backspace_pressed_last; | 67 bool backspace_pressed_last; |
67 PasswordInfo() : backspace_pressed_last(false) {} | 68 PasswordInfo() : backspace_pressed_last(false) {} |
68 }; | 69 }; |
69 typedef std::map<WebKit::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 70 typedef std::map<WebKit::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
| 71 typedef std::map<WebKit::WebFrame*, |
| 72 linked_ptr<content::PasswordForm> > FrameToPasswordForm; |
70 | 73 |
71 // RenderViewObserver: | 74 // RenderViewObserver: |
72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 76 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; |
| 77 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 78 bool is_new_navigation) OVERRIDE; |
73 virtual void DidStartLoading() OVERRIDE; | 79 virtual void DidStartLoading() OVERRIDE; |
74 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; | 80 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; |
75 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | 81 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
76 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; | 82 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; |
77 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; | 83 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; |
| 84 virtual void WillSendSubmitEvent(WebKit::WebFrame* frame, |
| 85 const WebKit::WebFormElement& form) OVERRIDE; |
| 86 virtual void WillSubmitForm(WebKit::WebFrame* frame, |
| 87 const WebKit::WebFormElement& form) OVERRIDE; |
78 | 88 |
79 // RenderView IPC handlers: | 89 // RenderView IPC handlers: |
80 void OnFillPasswordForm(const PasswordFormFillData& form_data); | 90 void OnFillPasswordForm(const PasswordFormFillData& form_data); |
81 | 91 |
82 // Scans the given frame for password forms and sends them up to the browser. | 92 // Scans the given frame for password forms and sends them up to the browser. |
83 // If |only_visible| is true, only forms visible in the layout are sent. | 93 // If |only_visible| is true, only forms visible in the layout are sent. |
84 void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); | 94 void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); |
85 | 95 |
86 void GetSuggestions(const PasswordFormFillData& fill_data, | 96 void GetSuggestions(const PasswordFormFillData& fill_data, |
87 const base::string16& input, | 97 const base::string16& input, |
(...skipping 28 matching lines...) Expand all Loading... |
116 | 126 |
117 // The logins we have filled so far with their associated info. | 127 // The logins we have filled so far with their associated info. |
118 LoginToPasswordInfoMap login_to_password_info_; | 128 LoginToPasswordInfoMap login_to_password_info_; |
119 | 129 |
120 // Used for UMA stats. | 130 // Used for UMA stats. |
121 OtherPossibleUsernamesUsage usernames_usage_; | 131 OtherPossibleUsernamesUsage usernames_usage_; |
122 | 132 |
123 // Pointer to the WebView. Used to access page scale factor. | 133 // Pointer to the WebView. Used to access page scale factor. |
124 WebKit::WebView* web_view_; | 134 WebKit::WebView* web_view_; |
125 | 135 |
| 136 // Set if the user might be submitting a password form on the current page, |
| 137 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
| 138 FrameToPasswordForm provisional_forms_; |
| 139 |
126 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 140 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
127 | 141 |
128 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 142 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
129 }; | 143 }; |
130 | 144 |
131 } // namespace autofill | 145 } // namespace autofill |
132 | 146 |
133 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 147 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |