Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: components/autofill/content/renderer/password_generation_agent.h

Issue 2216463002: [Autofill] Migrate ContentPasswordManagerDriver<-->Password{Autofill,Generation}Agent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nit from Vaclav Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/renderer/password_generation_agent.h
diff --git a/components/autofill/content/renderer/password_generation_agent.h b/components/autofill/content/renderer/password_generation_agent.h
index 47f3a912e3e6da05d171765c93e1f8cd697a7d8a..df2b9a7a7e757afbf3579a9dd089b5dc0c960d49 100644
--- a/components/autofill/content/renderer/password_generation_agent.h
+++ b/components/autofill/content/renderer/password_generation_agent.h
@@ -14,7 +14,10 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
+#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
+#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
+#include "mojo/public/cpp/bindings/binding.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "url/gurl.h"
@@ -32,12 +35,26 @@ class PasswordAutofillAgent;
// This class is responsible for controlling communication for password
// generation between the browser (which shows the popup and generates
// passwords) and WebKit (shows the generation icon in the password field).
-class PasswordGenerationAgent : public content::RenderFrameObserver {
+class PasswordGenerationAgent : public content::RenderFrameObserver,
+ public mojom::PasswordGenerationAgent {
public:
PasswordGenerationAgent(content::RenderFrame* render_frame,
PasswordAutofillAgent* password_agent);
~PasswordGenerationAgent() override;
+ void BindRequest(mojom::PasswordGenerationAgentRequest request);
+
+ // mojom::PasswordGenerationAgent:
+ void FormNotBlacklisted(const PasswordForm& form) override;
+ void GeneratedPasswordAccepted(const base::string16& password) override;
+ void FoundFormsEligibleForGeneration(
+ const std::vector<PasswordFormGenerationData>& forms) override;
+ // Sets |generation_element_| to the focused password field and shows a
+ // generation popup at this field.
+ void UserTriggeredGeneratePassword() override;
+ // Enables the form classifier.
+ void AllowToRunFormClassifier() override;
+
// Returns true if the field being changed is one where a generated password
// is being offered. Updates the state of the popup if necessary.
bool TextDidChangeInTextField(const blink::WebInputElement& element);
@@ -74,16 +91,11 @@ class PasswordGenerationAgent : public content::RenderFrameObserver {
typedef std::vector<AccountCreationFormData> AccountCreationFormDataList;
// RenderFrameObserver:
- bool OnMessageReceived(const IPC::Message& message) override;
void DidFinishDocumentLoad() override;
void DidFinishLoad() override;
void OnDestruct() override;
- // Message handlers.
- void OnFormNotBlacklisted(const PasswordForm& form);
- void OnPasswordAccepted(const base::string16& password);
- void OnFormsEligibleForGenerationFound(
- const std::vector<autofill::PasswordFormGenerationData>& forms);
+ const mojom::PasswordManagerDriverPtr& GetPasswordManagerDriver();
// Helper function that will try and populate |password_elements_| and
// |possible_account_creation_form_|.
@@ -103,13 +115,6 @@ class PasswordGenerationAgent : public content::RenderFrameObserver {
// Hides a password generation popup if one exists.
void HidePopup();
- // Sets |generation_element_| to the focused password field and shows a
- // generation popup at this field.
- void OnUserTriggeredGeneratePassword();
-
- // Enables the form classifier.
- void OnAllowToRunFormClassifier();
-
// Runs HTML parsing based classifier and saves its outcome to proto.
// TODO(crbug.com/621442): Remove client-side form classifier when server-side
// classifier is ready.
@@ -177,6 +182,8 @@ class PasswordGenerationAgent : public content::RenderFrameObserver {
// in password fields are updated.
PasswordAutofillAgent* password_agent_;
+ mojo::Binding<mojom::PasswordGenerationAgent> binding_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent);
};

Powered by Google App Engine
This is Rietveld 408576698