| 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 "components/autofill/content/renderer/renderer_save_password_progress_l
ogger.h" |
| 20 #include "content/public/renderer/render_frame_observer.h" | 20 #include "content/public/renderer/render_frame_observer.h" |
| 21 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
| 22 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 22 #include "third_party/WebKit/public/web/WebInputElement.h" | 23 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 24 | 25 |
| 25 namespace autofill { | 26 namespace autofill { |
| 26 | 27 |
| 27 struct PasswordForm; | 28 struct PasswordForm; |
| 28 struct PasswordFormGenerationData; | 29 struct PasswordFormGenerationData; |
| 29 class PasswordAutofillAgent; | 30 class PasswordAutofillAgent; |
| 30 | 31 |
| 31 // This class is responsible for controlling communication for password | 32 // This class is responsible for controlling communication for password |
| 32 // generation between the browser (which shows the popup and generates | 33 // generation between the browser (which shows the popup and generates |
| 33 // passwords) and WebKit (shows the generation icon in the password field). | 34 // passwords) and WebKit (shows the generation icon in the password field). |
| 34 class PasswordGenerationAgent : public content::RenderFrameObserver, | 35 class PasswordGenerationAgent : public content::RenderFrameObserver, |
| 35 public mojom::PasswordGenerationAgent { | 36 public mojom::PasswordGenerationAgent { |
| 36 public: | 37 public: |
| 37 PasswordGenerationAgent(content::RenderFrame* render_frame, | 38 PasswordGenerationAgent(content::RenderFrame* render_frame, |
| 38 PasswordAutofillAgent* password_agent); | 39 PasswordAutofillAgent* password_agent); |
| 39 ~PasswordGenerationAgent() override; | 40 ~PasswordGenerationAgent() override; |
| 40 | 41 |
| 41 void BindRequest(mojom::PasswordGenerationAgentRequest request); | 42 void BindRequest(const service_manager::BindSourceInfo& source_info, |
| 43 mojom::PasswordGenerationAgentRequest request); |
| 42 | 44 |
| 43 // mojom::PasswordGenerationAgent: | 45 // mojom::PasswordGenerationAgent: |
| 44 void FormNotBlacklisted(const PasswordForm& form) override; | 46 void FormNotBlacklisted(const PasswordForm& form) override; |
| 45 void GeneratedPasswordAccepted(const base::string16& password) override; | 47 void GeneratedPasswordAccepted(const base::string16& password) override; |
| 46 void FoundFormsEligibleForGeneration( | 48 void FoundFormsEligibleForGeneration( |
| 47 const std::vector<PasswordFormGenerationData>& forms) override; | 49 const std::vector<PasswordFormGenerationData>& forms) override; |
| 48 // Sets |generation_element_| to the focused password field and shows a | 50 // Sets |generation_element_| to the focused password field and shows a |
| 49 // generation popup at this field. | 51 // generation popup at this field. |
| 50 void UserTriggeredGeneratePassword() override; | 52 void UserTriggeredGeneratePassword() override; |
| 51 // Enables the form classifier. | 53 // Enables the form classifier. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 mojom::PasswordManagerClientAssociatedPtr password_manager_client_; | 194 mojom::PasswordManagerClientAssociatedPtr password_manager_client_; |
| 193 | 195 |
| 194 mojo::Binding<mojom::PasswordGenerationAgent> binding_; | 196 mojo::Binding<mojom::PasswordGenerationAgent> binding_; |
| 195 | 197 |
| 196 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); | 198 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 } // namespace autofill | 201 } // namespace autofill |
| 200 | 202 |
| 201 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ | 203 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
| OLD | NEW |