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

Unified Diff: components/password_manager/core/browser/password_generation_manager.cc

Issue 2334543003: [Password Generation] Move canonical action computation from rendered to browser part (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « components/autofill/content/renderer/password_generation_agent.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_generation_manager.cc
diff --git a/components/password_manager/core/browser/password_generation_manager.cc b/components/password_manager/core/browser/password_generation_manager.cc
index d1b364127922e52a75cb1f0169154becc7a1fdaa..607a7adc26a533a9fe5f3c7635ccf057a007488c 100644
--- a/components/password_manager/core/browser/password_generation_manager.cc
+++ b/components/password_manager/core/browser/password_generation_manager.cc
@@ -14,6 +14,24 @@
namespace password_manager {
+namespace {
+
+// Helper function that returns canonical action based on |target_url| and
+// |source_url|.
+GURL GetCanonicalAction(const GURL& source_url, const GURL& target_url) {
+ GURL action = target_url;
+ if (action.is_empty())
+ action = source_url;
+ GURL::Replacements rep;
+ rep.ClearUsername();
+ rep.ClearPassword();
+ rep.ClearQuery();
+ rep.ClearRef();
+ return action.ReplaceComponents(rep);
+}
+
+} // namespace
+
PasswordGenerationManager::PasswordGenerationManager(
PasswordManagerClient* client,
PasswordManagerDriver* driver)
@@ -41,8 +59,10 @@ void PasswordGenerationManager::DetectFormsEligibleForGeneration(
if (field->server_type() == autofill::ACCOUNT_CREATION_PASSWORD ||
field->server_type() == autofill::NEW_PASSWORD) {
forms_eligible_for_generation.push_back(
- autofill::PasswordFormGenerationData{form->form_name(),
- form->target_url(), *field});
+ autofill::PasswordFormGenerationData{
+ form->form_name(),
+ GetCanonicalAction(form->source_url(), form->target_url()),
+ *field});
break;
}
}
« no previous file with comments | « components/autofill/content/renderer/password_generation_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698