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; | |
Ilya Sherman
2013/07/27 01:09:48
nit: Please include "Map" in this type name.
Garrett Casto
2013/08/03 00:38:42
Done.
| |
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; | |
73 virtual void DidStartLoading() OVERRIDE; | 77 virtual void DidStartLoading() OVERRIDE; |
74 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; | 78 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; |
75 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | 79 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
76 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; | 80 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; |
77 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; | 81 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; |
82 virtual void WillSendSubmitEvent(WebKit::WebFrame* frame, | |
83 const WebKit::WebFormElement& form) OVERRIDE; | |
84 virtual void WillSubmitForm(WebKit::WebFrame* frame, | |
85 const WebKit::WebFormElement& form) OVERRIDE; | |
78 | 86 |
79 // RenderView IPC handlers: | 87 // RenderView IPC handlers: |
80 void OnFillPasswordForm(const PasswordFormFillData& form_data); | 88 void OnFillPasswordForm(const PasswordFormFillData& form_data); |
81 | 89 |
82 // Scans the given frame for password forms and sends them up to the browser. | 90 // 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. | 91 // If |only_visible| is true, only forms visible in the layout are sent. |
84 void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); | 92 void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); |
85 | 93 |
86 void GetSuggestions(const PasswordFormFillData& fill_data, | 94 void GetSuggestions(const PasswordFormFillData& fill_data, |
87 const base::string16& input, | 95 const base::string16& input, |
(...skipping 28 matching lines...) Expand all Loading... | |
116 | 124 |
117 // The logins we have filled so far with their associated info. | 125 // The logins we have filled so far with their associated info. |
118 LoginToPasswordInfoMap login_to_password_info_; | 126 LoginToPasswordInfoMap login_to_password_info_; |
119 | 127 |
120 // Used for UMA stats. | 128 // Used for UMA stats. |
121 OtherPossibleUsernamesUsage usernames_usage_; | 129 OtherPossibleUsernamesUsage usernames_usage_; |
122 | 130 |
123 // Pointer to the WebView. Used to access page scale factor. | 131 // Pointer to the WebView. Used to access page scale factor. |
124 WebKit::WebView* web_view_; | 132 WebKit::WebView* web_view_; |
125 | 133 |
134 // Set if the user might be submitting a password form on the current page, | |
135 // but the submit may still fail (i.e. doesn't pass JavaScript validation). | |
136 FrameToPasswordForm provisional_forms_; | |
Ilya Sherman
2013/07/27 01:09:48
Optional nit: Perhaps |provisionally_saved_forms_|
Garrett Casto
2013/08/03 00:38:42
Done.
| |
137 | |
126 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 138 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
127 | 139 |
128 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 140 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
129 }; | 141 }; |
130 | 142 |
131 } // namespace autofill | 143 } // namespace autofill |
132 | 144 |
133 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 145 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |