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

Side by Side Diff: components/password_manager/content/browser/content_password_manager_driver.cc

Issue 686653003: Don't use FormFieldData only as a key in a map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/password_manager/content/browser/content_password_manager_d river.h" 5 #include "components/password_manager/content/browser/content_password_manager_d river.h"
6 6
7 #include "components/autofill/content/browser/content_autofill_driver.h" 7 #include "components/autofill/content/browser/content_autofill_driver.h"
8 #include "components/autofill/content/common/autofill_messages.h" 8 #include "components/autofill/content/common/autofill_messages.h"
9 #include "components/autofill/core/common/form_data.h" 9 #include "components/autofill/core/common/form_data.h"
10 #include "components/autofill/core/common/password_form.h" 10 #include "components/autofill/core/common/password_form.h"
11 #include "components/password_manager/core/browser/password_manager_client.h" 11 #include "components/password_manager/core/browser/password_manager_client.h"
12 #include "content/public/browser/browser_context.h" 12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/navigation_details.h" 13 #include "content/public/browser/navigation_details.h"
14 #include "content/public/browser/navigation_entry.h" 14 #include "content/public/browser/navigation_entry.h"
15 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/ssl_status.h" 17 #include "content/public/common/ssl_status.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "net/cert/cert_status_flags.h" 19 #include "net/cert/cert_status_flags.h"
20 20
21 namespace password_manager { 21 namespace password_manager {
22 22
23 ContentPasswordManagerDriver::ContentPasswordManagerDriver( 23 ContentPasswordManagerDriver::ContentPasswordManagerDriver(
24 content::WebContents* web_contents, 24 content::WebContents* web_contents,
25 PasswordManagerClient* client, 25 PasswordManagerClient* client,
26 autofill::AutofillClient* autofill_client) 26 autofill::AutofillClient* autofill_client)
27 : WebContentsObserver(web_contents), 27 : WebContentsObserver(web_contents),
28 password_manager_(client), 28 password_manager_(client),
29 password_generation_manager_(client), 29 password_generation_manager_(client),
30 password_autofill_manager_(client, autofill_client) { 30 password_autofill_manager_(client, autofill_client),
31 next_free_key_(0) {
31 DCHECK(web_contents); 32 DCHECK(web_contents);
32 } 33 }
33 34
34 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {} 35 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {}
35 36
36 void ContentPasswordManagerDriver::FillPasswordForm( 37 void ContentPasswordManagerDriver::FillPasswordForm(
37 const autofill::PasswordFormFillData& form_data) { 38 const autofill::PasswordFormFillData& form_data) {
39 const int key = next_free_key_++;
40 password_autofill_manager_.OnAddPasswordFormMapping(key, form_data);
38 DCHECK(web_contents()); 41 DCHECK(web_contents());
39 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_FillPasswordForm( 42 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_FillPasswordForm(
40 web_contents()->GetRenderViewHost()->GetRoutingID(), form_data)); 43 web_contents()->GetRenderViewHost()->GetRoutingID(), key, form_data));
41 } 44 }
42 45
43 void ContentPasswordManagerDriver::AllowPasswordGenerationForForm( 46 void ContentPasswordManagerDriver::AllowPasswordGenerationForForm(
44 const autofill::PasswordForm& form) { 47 const autofill::PasswordForm& form) {
45 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 48 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
46 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), form)); 49 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), form));
47 } 50 }
48 51
49 void ContentPasswordManagerDriver::AccountCreationFormsFound( 52 void ContentPasswordManagerDriver::AccountCreationFormsFound(
50 const std::vector<autofill::FormData>& forms) { 53 const std::vector<autofill::FormData>& forms) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 PasswordManager::OnPasswordFormsParsed) 129 PasswordManager::OnPasswordFormsParsed)
127 IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormsRendered, 130 IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormsRendered,
128 &password_manager_, 131 &password_manager_,
129 PasswordManager::OnPasswordFormsRendered) 132 PasswordManager::OnPasswordFormsRendered)
130 IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormSubmitted, 133 IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormSubmitted,
131 &password_manager_, 134 &password_manager_,
132 PasswordManager::OnPasswordFormSubmitted) 135 PasswordManager::OnPasswordFormSubmitted)
133 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, 136 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions,
134 &password_autofill_manager_, 137 &password_autofill_manager_,
135 PasswordAutofillManager::OnShowPasswordSuggestions) 138 PasswordAutofillManager::OnShowPasswordSuggestions)
136 IPC_MESSAGE_FORWARD(AutofillHostMsg_AddPasswordFormMapping,
137 &password_autofill_manager_,
138 PasswordAutofillManager::OnAddPasswordFormMapping)
139 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, 139 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress,
140 password_manager_.client(), 140 password_manager_.client(),
141 PasswordManagerClient::LogSavePasswordProgress) 141 PasswordManagerClient::LogSavePasswordProgress)
142 IPC_MESSAGE_UNHANDLED(handled = false) 142 IPC_MESSAGE_UNHANDLED(handled = false)
143 IPC_END_MESSAGE_MAP() 143 IPC_END_MESSAGE_MAP()
144 144
145 return handled; 145 return handled;
146 } 146 }
147 147
148 autofill::AutofillManager* ContentPasswordManagerDriver::GetAutofillManager() { 148 autofill::AutofillManager* ContentPasswordManagerDriver::GetAutofillManager() {
149 autofill::ContentAutofillDriver* driver = 149 autofill::ContentAutofillDriver* driver =
150 autofill::ContentAutofillDriver::FromWebContents(web_contents()); 150 autofill::ContentAutofillDriver::FromWebContents(web_contents());
151 return driver ? driver->autofill_manager() : NULL; 151 return driver ? driver->autofill_manager() : NULL;
152 } 152 }
153 153
154 } // namespace password_manager 154 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698