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

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

Issue 2073143002: [Password Generation] Run the form classifier only if AutofillMetadata is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pg_classifier_votes
Patch Set: Removed unnecessary ';' 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 host->Send( 129 host->Send(
130 new AutofillMsg_UserTriggeredGeneratePassword(host->GetRoutingID())); 130 new AutofillMsg_UserTriggeredGeneratePassword(host->GetRoutingID()));
131 } 131 }
132 132
133 void ContentPasswordManagerDriver::SendLoggingAvailability() { 133 void ContentPasswordManagerDriver::SendLoggingAvailability() {
134 render_frame_host_->Send(new AutofillMsg_SetLoggingState( 134 render_frame_host_->Send(new AutofillMsg_SetLoggingState(
135 render_frame_host_->GetRoutingID(), 135 render_frame_host_->GetRoutingID(),
136 client_->GetLogManager()->IsLoggingActive())); 136 client_->GetLogManager()->IsLoggingActive()));
137 } 137 }
138 138
139 void ContentPasswordManagerDriver::AllowToRunFormClassifier() {
140 render_frame_host_->Send(new AutofillMsg_AllowToRunFormClassifier(
141 render_frame_host_->GetRoutingID()));
142 }
143
139 PasswordGenerationManager* 144 PasswordGenerationManager*
140 ContentPasswordManagerDriver::GetPasswordGenerationManager() { 145 ContentPasswordManagerDriver::GetPasswordGenerationManager() {
141 return &password_generation_manager_; 146 return &password_generation_manager_;
142 } 147 }
143 148
144 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { 149 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() {
145 return client_->GetPasswordManager(); 150 return client_->GetPasswordManager();
146 } 151 }
147 152
148 PasswordAutofillManager* 153 PasswordAutofillManager*
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 if (!CheckChildProcessSecurityPolicy( 192 if (!CheckChildProcessSecurityPolicy(
188 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) 193 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED))
189 return; 194 return;
190 195
191 OnPasswordFormsParsedNoRenderCheck(forms); 196 OnPasswordFormsParsedNoRenderCheck(forms);
192 } 197 }
193 198
194 void ContentPasswordManagerDriver::OnPasswordFormsParsedNoRenderCheck( 199 void ContentPasswordManagerDriver::OnPasswordFormsParsedNoRenderCheck(
195 const std::vector<autofill::PasswordForm>& forms) { 200 const std::vector<autofill::PasswordForm>& forms) {
196 GetPasswordManager()->OnPasswordFormsParsed(this, forms); 201 GetPasswordManager()->OnPasswordFormsParsed(this, forms);
202 GetPasswordGenerationManager()->CheckIfFormClassifierShouldRun();
197 } 203 }
198 204
199 void ContentPasswordManagerDriver::OnPasswordFormsRendered( 205 void ContentPasswordManagerDriver::OnPasswordFormsRendered(
200 const std::vector<autofill::PasswordForm>& visible_forms, 206 const std::vector<autofill::PasswordForm>& visible_forms,
201 bool did_stop_loading) { 207 bool did_stop_loading) {
202 for (const auto& form : visible_forms) 208 for (const auto& form : visible_forms)
203 if (!CheckChildProcessSecurityPolicy( 209 if (!CheckChildProcessSecurityPolicy(
204 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED)) 210 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED))
205 return; 211 return;
206 GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms, 212 GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), 289 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(),
284 url)) { 290 url)) {
285 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); 291 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason);
286 return false; 292 return false;
287 } 293 }
288 294
289 return true; 295 return true;
290 } 296 }
291 297
292 } // namespace password_manager 298 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698