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

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

Issue 2362523003: Add (some) password detection for HTTP-bad (Closed)
Patch Set: trigger the downgrade from OnPasswordFormsParsed Created 4 years, 2 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/browser/content_autofill_driver.h" 7 #include "components/autofill/content/browser/content_autofill_driver.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"
11 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" 11 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
12 #include "components/password_manager/core/browser/log_manager.h" 12 #include "components/password_manager/core/browser/log_manager.h"
13 #include "components/password_manager/core/browser/password_manager.h" 13 #include "components/password_manager/core/browser/password_manager.h"
14 #include "components/password_manager/core/browser/password_manager_client.h" 14 #include "components/password_manager/core/browser/password_manager_client.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/child_process_security_policy.h" 16 #include "content/public/browser/child_process_security_policy.h"
17 #include "content/public/browser/navigation_details.h" 17 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/render_frame_host.h" 19 #include "content/public/browser/render_frame_host.h"
20 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/render_view_host.h" 21 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/site_instance.h" 22 #include "content/public/browser/site_instance.h"
23 #include "content/public/browser/ssl_status.h" 23 #include "content/public/browser/ssl_status.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/origin_util.h"
25 #include "net/cert/cert_status_flags.h" 26 #include "net/cert/cert_status_flags.h"
26 #include "services/shell/public/cpp/interface_provider.h" 27 #include "services/shell/public/cpp/interface_provider.h"
27 28
28 namespace password_manager { 29 namespace password_manager {
29 30
31 namespace {
32
33 void MaybeNotifyPasswordInputShownOnHttp(content::RenderFrameHost* rfh) {
34 content::WebContents* web_contents =
35 content::WebContents::FromRenderFrameHost(rfh);
36 if (!content::IsOriginSecure(web_contents->GetVisibleURL())) {
37 web_contents->OnPasswordInputShownOnHttp();
38 }
39 }
40
41 } // namespace
42
30 ContentPasswordManagerDriver::ContentPasswordManagerDriver( 43 ContentPasswordManagerDriver::ContentPasswordManagerDriver(
31 content::RenderFrameHost* render_frame_host, 44 content::RenderFrameHost* render_frame_host,
32 PasswordManagerClient* client, 45 PasswordManagerClient* client,
33 autofill::AutofillClient* autofill_client) 46 autofill::AutofillClient* autofill_client)
34 : render_frame_host_(render_frame_host), 47 : render_frame_host_(render_frame_host),
35 client_(client), 48 client_(client),
36 password_generation_manager_(client, this), 49 password_generation_manager_(client, this),
37 password_autofill_manager_(this, autofill_client), 50 password_autofill_manager_(this, autofill_client),
38 next_free_key_(0), 51 next_free_key_(0),
39 binding_(this), 52 binding_(this),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 for (const auto& form : forms) 162 for (const auto& form : forms)
150 if (!CheckChildProcessSecurityPolicy( 163 if (!CheckChildProcessSecurityPolicy(
151 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) 164 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED))
152 return; 165 return;
153 166
154 OnPasswordFormsParsedNoRenderCheck(forms); 167 OnPasswordFormsParsedNoRenderCheck(forms);
155 } 168 }
156 169
157 void ContentPasswordManagerDriver::OnPasswordFormsParsedNoRenderCheck( 170 void ContentPasswordManagerDriver::OnPasswordFormsParsedNoRenderCheck(
158 const std::vector<autofill::PasswordForm>& forms) { 171 const std::vector<autofill::PasswordForm>& forms) {
172 MaybeNotifyPasswordInputShownOnHttp(render_frame_host_);
159 GetPasswordManager()->OnPasswordFormsParsed(this, forms); 173 GetPasswordManager()->OnPasswordFormsParsed(this, forms);
160 GetPasswordGenerationManager()->CheckIfFormClassifierShouldRun(); 174 GetPasswordGenerationManager()->CheckIfFormClassifierShouldRun();
161 } 175 }
162 176
163 void ContentPasswordManagerDriver::PasswordFormsRendered( 177 void ContentPasswordManagerDriver::PasswordFormsRendered(
164 const std::vector<autofill::PasswordForm>& visible_forms, 178 const std::vector<autofill::PasswordForm>& visible_forms,
165 bool did_stop_loading) { 179 bool did_stop_loading) {
166 for (const auto& form : visible_forms) 180 for (const auto& form : visible_forms)
167 if (!CheckChildProcessSecurityPolicy( 181 if (!CheckChildProcessSecurityPolicy(
168 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED)) 182 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED))
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { 314 ContentPasswordManagerDriver::GetPasswordGenerationAgent() {
301 if (!password_gen_agent_) { 315 if (!password_gen_agent_) {
302 render_frame_host_->GetRemoteInterfaces()->GetInterface( 316 render_frame_host_->GetRemoteInterfaces()->GetInterface(
303 mojo::GetProxy(&password_gen_agent_)); 317 mojo::GetProxy(&password_gen_agent_));
304 } 318 }
305 319
306 return password_gen_agent_; 320 return password_gen_agent_;
307 } 321 }
308 322
309 } // namespace password_manager 323 } // namespace password_manager
OLDNEW
« no previous file with comments | « chrome/test/data/password/simple_password_in_iframe.html ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698