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 <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 13 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
14 #include "components/autofill/core/common/form_data_predictions.h" | 14 #include "components/autofill/core/common/form_data_predictions.h" |
15 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 15 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
16 #include "components/autofill/core/common/password_form_fill_data.h" | 16 #include "components/autofill/core/common/password_form_fill_data.h" |
17 #include "content/public/renderer/render_frame_observer.h" | 17 #include "content/public/renderer/render_frame_observer.h" |
18 #include "content/public/renderer/render_view_observer.h" | 18 #include "content/public/renderer/render_view_observer.h" |
19 #include "third_party/WebKit/public/web/WebInputElement.h" | 19 #include "third_party/WebKit/public/web/WebInputElement.h" |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 class WebInputElement; | 22 class WebInputElement; |
23 class WebKeyboardEvent; | 23 class WebKeyboardEvent; |
24 class WebSecurityOrigin; | 24 class WebSecurityOrigin; |
25 } | 25 } |
26 | 26 |
27 namespace autofill { | 27 namespace autofill { |
28 | 28 |
| 29 class RendererSavePasswordProgressLogger; |
| 30 |
29 // This class is responsible for filling password forms. | 31 // This class is responsible for filling password forms. |
30 class PasswordAutofillAgent : public content::RenderFrameObserver { | 32 class PasswordAutofillAgent : public content::RenderFrameObserver { |
31 public: | 33 public: |
32 explicit PasswordAutofillAgent(content::RenderFrame* render_frame); | 34 explicit PasswordAutofillAgent(content::RenderFrame* render_frame); |
33 ~PasswordAutofillAgent() override; | 35 ~PasswordAutofillAgent() override; |
34 | 36 |
35 // WebFrameClient editor related calls forwarded by AutofillAgent. | 37 // WebFrameClient editor related calls forwarded by AutofillAgent. |
36 // If they return true, it indicates the event was consumed and should not | 38 // If they return true, it indicates the event was consumed and should not |
37 // be used for any other autofill activity. | 39 // be used for any other autofill activity. |
38 bool TextFieldDidEndEditing(const blink::WebInputElement& element); | 40 bool TextFieldDidEndEditing(const blink::WebInputElement& element); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 80 |
79 // Called when an AJAX has succesfully completed. Used to determine if | 81 // Called when an AJAX has succesfully completed. Used to determine if |
80 // a form has been submitted by AJAX without navigation. | 82 // a form has been submitted by AJAX without navigation. |
81 void AJAXSucceeded(); | 83 void AJAXSucceeded(); |
82 | 84 |
83 // Called when the user first interacts with the page after a load. This is a | 85 // Called when the user first interacts with the page after a load. This is a |
84 // signal to make autofilled values of password input elements accessible to | 86 // signal to make autofilled values of password input elements accessible to |
85 // JavaScript. | 87 // JavaScript. |
86 void FirstUserGestureObserved(); | 88 void FirstUserGestureObserved(); |
87 | 89 |
| 90 // Given password form data |form_data| and a supplied key |key| for |
| 91 // referencing the password info, returns a set of WebInputElements in |
| 92 // |elements|, which must be non-null, that the password manager has values |
| 93 // for filling. Also takes an optional logger |logger| for logging password |
| 94 // autofill behavior. |
| 95 void GetFillableElementFromFormData( |
| 96 int key, |
| 97 const PasswordFormFillData& form_data, |
| 98 RendererSavePasswordProgressLogger* logger, |
| 99 std::vector<blink::WebInputElement>* elements); |
| 100 |
| 101 bool logging_state_active() const { return logging_state_active_; } |
| 102 |
88 protected: | 103 protected: |
89 virtual bool OriginCanAccessPasswordManager( | 104 virtual bool OriginCanAccessPasswordManager( |
90 const blink::WebSecurityOrigin& origin); | 105 const blink::WebSecurityOrigin& origin); |
91 | 106 |
92 private: | 107 private: |
93 // Ways to restrict which passwords are saved in ProvisionallySavePassword. | 108 // Ways to restrict which passwords are saved in ProvisionallySavePassword. |
94 enum ProvisionallySaveRestriction { | 109 enum ProvisionallySaveRestriction { |
95 RESTRICTION_NONE, | 110 RESTRICTION_NONE, |
96 RESTRICTION_NON_EMPTY_PASSWORD | 111 RESTRICTION_NON_EMPTY_PASSWORD |
97 }; | 112 }; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // Contains server predictions for username, password and/or new password | 254 // Contains server predictions for username, password and/or new password |
240 // fields for individual forms. | 255 // fields for individual forms. |
241 FormsPredictionsMap form_predictions_; | 256 FormsPredictionsMap form_predictions_; |
242 | 257 |
243 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 258 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
244 }; | 259 }; |
245 | 260 |
246 } // namespace autofill | 261 } // namespace autofill |
247 | 262 |
248 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 263 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |