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

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

Issue 2055633003: [Password Generation] Sends form classifier vote to autofill server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pg_form_classification
Patch Set: replaced " DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()) Created 4 years, 6 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 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/common/autofill_messages.h" 7 #include "components/autofill/content/common/autofill_messages.h"
8 #include "components/autofill/core/common/form_data.h" 8 #include "components/autofill/core/common/form_data.h"
9 #include "components/autofill/core/common/password_form.h" 9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/browser/bad_message.h" 10 #include "components/password_manager/content/browser/bad_message.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message) 155 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message)
156 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed, 156 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed,
157 OnPasswordFormsParsed) 157 OnPasswordFormsParsed)
158 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered, 158 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered,
159 OnPasswordFormsRendered) 159 OnPasswordFormsRendered)
160 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, 160 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted,
161 OnPasswordFormSubmitted) 161 OnPasswordFormSubmitted)
162 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) 162 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation)
163 IPC_MESSAGE_HANDLER(AutofillHostMsg_PresaveGeneratedPassword, 163 IPC_MESSAGE_HANDLER(AutofillHostMsg_PresaveGeneratedPassword,
164 OnPresaveGeneratedPassword) 164 OnPresaveGeneratedPassword)
165 IPC_MESSAGE_HANDLER(AutofillHostMsg_SaveGenerationFieldDetectedByClassifier,
166 OnSaveGenerationFieldDetectedByClassifier)
165 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, 167 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated,
166 OnPasswordNoLongerGenerated) 168 OnPasswordNoLongerGenerated)
167 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, 169 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound,
168 OnFocusedPasswordFormFound) 170 OnFocusedPasswordFormFound)
169 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, 171 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions,
170 &password_autofill_manager_, 172 &password_autofill_manager_,
171 PasswordAutofillManager::OnShowPasswordSuggestions) 173 PasswordAutofillManager::OnShowPasswordSuggestions)
172 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, 174 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress,
173 client_->GetLogManager(), 175 client_->GetLogManager(),
174 LogManager::LogSavePasswordProgress) 176 LogManager::LogSavePasswordProgress)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( 256 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated(
255 const autofill::PasswordForm& password_form) { 257 const autofill::PasswordForm& password_form) {
256 if (!CheckChildProcessSecurityPolicy( 258 if (!CheckChildProcessSecurityPolicy(
257 password_form.origin, 259 password_form.origin,
258 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) 260 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED))
259 return; 261 return;
260 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, 262 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form,
261 false); 263 false);
262 } 264 }
263 265
266 void ContentPasswordManagerDriver::OnSaveGenerationFieldDetectedByClassifier(
267 const autofill::PasswordForm& password_form,
268 const base::string16& generation_field) {
269 if (!CheckChildProcessSecurityPolicy(
270 password_form.origin,
271 BadMessageReason::
272 CPMD_BAD_ORIGIN_SAVE_GENERATION_FIELD_DETECTED_BY_CLASSIFIER))
273 return;
274 GetPasswordManager()->SaveGenerationFieldDetectedByClassifier(
275 password_form, generation_field);
276 }
277
264 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( 278 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy(
265 const GURL& url, 279 const GURL& url,
266 BadMessageReason reason) { 280 BadMessageReason reason) {
267 content::ChildProcessSecurityPolicy* policy = 281 content::ChildProcessSecurityPolicy* policy =
268 content::ChildProcessSecurityPolicy::GetInstance(); 282 content::ChildProcessSecurityPolicy::GetInstance();
269 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), 283 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(),
270 url)) { 284 url)) {
271 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); 285 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason);
272 return false; 286 return false;
273 } 287 }
274 288
275 return true; 289 return true;
276 } 290 }
277 291
278 } // namespace password_manager 292 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698