| 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_GENERATION_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 17 #include "components/autofill/content/common/autofill_agent.mojom.h" | 17 #include "components/autofill/content/common/autofill_agent.mojom.h" |
| 18 #include "components/autofill/content/common/autofill_driver.mojom.h" | 18 #include "components/autofill/content/common/autofill_driver.mojom.h" |
| 19 #include "components/autofill/content/renderer/renderer_save_password_progress_l
ogger.h" |
| 19 #include "content/public/renderer/render_frame_observer.h" | 20 #include "content/public/renderer/render_frame_observer.h" |
| 20 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
| 21 #include "third_party/WebKit/public/web/WebInputElement.h" | 22 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 23 | 24 |
| 24 namespace autofill { | 25 namespace autofill { |
| 25 | 26 |
| 26 struct PasswordForm; | 27 struct PasswordForm; |
| 27 struct PasswordFormGenerationData; | 28 struct PasswordFormGenerationData; |
| 28 class PasswordAutofillAgent; | 29 class PasswordAutofillAgent; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 59 | 60 |
| 60 // Called when new form controls are inserted. | 61 // Called when new form controls are inserted. |
| 61 void OnDynamicFormsSeen(); | 62 void OnDynamicFormsSeen(); |
| 62 | 63 |
| 63 // The length that a password can be before the UI is hidden. | 64 // The length that a password can be before the UI is hidden. |
| 64 static const size_t kMaximumOfferSize = 5; | 65 static const size_t kMaximumOfferSize = 5; |
| 65 | 66 |
| 66 protected: | 67 protected: |
| 67 // Returns true if the document for |render_frame()| is one that we should | 68 // Returns true if the document for |render_frame()| is one that we should |
| 68 // consider analyzing. Virtual so that it can be overriden during testing. | 69 // consider analyzing. Virtual so that it can be overriden during testing. |
| 69 virtual bool ShouldAnalyzeDocument() const; | 70 virtual bool ShouldAnalyzeDocument(); |
| 70 | 71 |
| 71 // Use to force enable during testing. | 72 // Use to force enable during testing. |
| 72 void set_enabled(bool enabled) { enabled_ = enabled; } | 73 void set_enabled(bool enabled) { enabled_ = enabled; } |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 struct AccountCreationFormData { | 76 struct AccountCreationFormData { |
| 76 linked_ptr<PasswordForm> form; | 77 linked_ptr<PasswordForm> form; |
| 77 std::vector<blink::WebInputElement> password_elements; | 78 std::vector<blink::WebInputElement> password_elements; |
| 78 | 79 |
| 79 AccountCreationFormData( | 80 AccountCreationFormData( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 112 |
| 112 // Hides a password generation popup if one exists. | 113 // Hides a password generation popup if one exists. |
| 113 void HidePopup(); | 114 void HidePopup(); |
| 114 | 115 |
| 115 // Runs HTML parsing based classifier and saves its outcome to proto. | 116 // Runs HTML parsing based classifier and saves its outcome to proto. |
| 116 // TODO(crbug.com/621442): Remove client-side form classifier when server-side | 117 // TODO(crbug.com/621442): Remove client-side form classifier when server-side |
| 117 // classifier is ready. | 118 // classifier is ready. |
| 118 void RunFormClassifierAndSaveVote(const blink::WebFormElement& web_form, | 119 void RunFormClassifierAndSaveVote(const blink::WebFormElement& web_form, |
| 119 const PasswordForm& form); | 120 const PasswordForm& form); |
| 120 | 121 |
| 122 void LogMessage(autofill::SavePasswordProgressLogger::StringID message_id); |
| 123 void LogBoolean(autofill::SavePasswordProgressLogger::StringID message_id, |
| 124 bool truth_value); |
| 125 void LogNumber(autofill::SavePasswordProgressLogger::StringID message_id, |
| 126 int number); |
| 127 |
| 121 // Creates a password form to presave a generated password. It copies behavior | 128 // Creates a password form to presave a generated password. It copies behavior |
| 122 // of CreatePasswordFormFromWebForm/FromUnownedInputElements, but takes | 129 // of CreatePasswordFormFromWebForm/FromUnownedInputElements, but takes |
| 123 // |password_value| from |generation_element_| and empties |username_value|. | 130 // |password_value| from |generation_element_| and empties |username_value|. |
| 124 // If a form creating is failed, returns an empty unique_ptr. | 131 // If a form creating is failed, returns an empty unique_ptr. |
| 125 std::unique_ptr<PasswordForm> CreatePasswordFormToPresave(); | 132 std::unique_ptr<PasswordForm> CreatePasswordFormToPresave(); |
| 126 | 133 |
| 127 // Stores forms that are candidates for account creation. | 134 // Stores forms that are candidates for account creation. |
| 128 AccountCreationFormDataList possible_account_creation_forms_; | 135 AccountCreationFormDataList possible_account_creation_forms_; |
| 129 | 136 |
| 130 // Stores the origins of the password forms confirmed not to be blacklisted | 137 // Stores the origins of the password forms confirmed not to be blacklisted |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 mojom::PasswordManagerClientAssociatedPtr password_manager_client_; | 189 mojom::PasswordManagerClientAssociatedPtr password_manager_client_; |
| 183 | 190 |
| 184 mojo::Binding<mojom::PasswordGenerationAgent> binding_; | 191 mojo::Binding<mojom::PasswordGenerationAgent> binding_; |
| 185 | 192 |
| 186 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); | 193 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); |
| 187 }; | 194 }; |
| 188 | 195 |
| 189 } // namespace autofill | 196 } // namespace autofill |
| 190 | 197 |
| 191 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ | 198 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
| OLD | NEW |