Index: chrome/browser/password_manager/password_generation_manager.cc |
diff --git a/chrome/browser/password_manager/password_generation_manager.cc b/chrome/browser/password_manager/password_generation_manager.cc |
index e53f61a7b682589a664f9ab33aa35e8a7133edcd..b266c2da824c8b7949c278175fb04fa6cae72193 100644 |
--- a/chrome/browser/password_manager/password_generation_manager.cc |
+++ b/chrome/browser/password_manager/password_generation_manager.cc |
@@ -13,6 +13,9 @@ |
#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/browser_window.h" |
#include "chrome/common/pref_names.h" |
+#include "components/autofill/core/browser/autofill_field.h" |
+#include "components/autofill/core/browser/field_types.h" |
+#include "components/autofill/core/browser/form_structure.h" |
#include "components/autofill/core/browser/password_generator.h" |
#include "components/autofill/core/common/autofill_messages.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
@@ -55,6 +58,25 @@ void PasswordGenerationManager::RegisterProfilePrefs( |
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
} |
+void PasswordGenerationManager::DetectAccountCreationForms( |
+ const std::vector<autofill::FormStructure*>& forms) { |
+ std::vector<GURL> account_creation_form_origins; |
+ for (std::vector<autofill::FormStructure*>::const_iterator form_it = |
+ forms.begin(); form_it != forms.end(); ++form_it) { |
+ autofill::FormStructure* form = *form_it; |
+ for (std::vector<autofill::AutofillField*>::const_iterator field_it = |
+ form->begin(); field_it != form->end(); ++field_it) { |
Ilya Sherman
2013/08/29 23:08:13
nit: Indent this line 5 more spaces.
zysxqn
2013/09/03 23:00:20
Done.
|
+ autofill::AutofillField* field = *field_it; |
+ if (field->server_type() == autofill::ACCOUNT_CREATION_PASSWORD) { |
+ account_creation_form_origins.push_back(form->source_url()); |
Garrett Casto
2013/08/29 22:45:13
So I don't have an example to point to right now,
zysxqn
2013/09/03 23:00:20
Done.
|
+ break; |
+ } |
+ } |
+ } |
+ SendAccountCreationFormsToRenderer(web_contents()->GetRenderViewHost(), |
+ account_creation_form_origins); |
+} |
+ |
void PasswordGenerationManager::RegisterWithSyncService() { |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
@@ -151,6 +173,12 @@ void PasswordGenerationManager::SendStateToRenderer( |
enabled)); |
} |
+void PasswordGenerationManager::SendAccountCreationFormsToRenderer( |
+ content::RenderViewHost* host, const std::vector<GURL>& origins) { |
+ host->Send(new AutofillMsg_AccountCreationFormsDetected( |
+ host->GetRoutingID(), origins)); |
+} |
Ilya Sherman
2013/08/29 23:08:13
nit: Why not just inline this method?
zysxqn
2013/09/03 23:00:20
I don't have strong preference on this one but I u
|
+ |
void PasswordGenerationManager::OnShowPasswordGenerationPopup( |
const gfx::Rect& bounds, |
int max_length, |