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

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

Issue 2467773002: Notify SSLManager when all password fields on a page are gone (Closed)
Patch Set: tweak SSLManager comment Created 4 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 <set>
8
7 #include "components/autofill/content/browser/content_autofill_driver.h" 9 #include "components/autofill/content/browser/content_autofill_driver.h"
8 #include "components/autofill/core/common/form_data.h" 10 #include "components/autofill/core/common/form_data.h"
9 #include "components/autofill/core/common/password_form.h" 11 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/browser/bad_message.h" 12 #include "components/password_manager/content/browser/bad_message.h"
11 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" 13 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
14 #include "components/password_manager/content/browser/visible_password_observer. h"
12 #include "components/password_manager/core/browser/log_manager.h" 15 #include "components/password_manager/core/browser/log_manager.h"
13 #include "components/password_manager/core/browser/password_manager.h" 16 #include "components/password_manager/core/browser/password_manager.h"
14 #include "components/password_manager/core/browser/password_manager_client.h" 17 #include "components/password_manager/core/browser/password_manager_client.h"
15 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/child_process_security_policy.h" 19 #include "content/public/browser/child_process_security_policy.h"
17 #include "content/public/browser/navigation_details.h" 20 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/navigation_entry.h" 21 #include "content/public/browser/navigation_entry.h"
22 #include "content/public/browser/navigation_handle.h"
19 #include "content/public/browser/render_frame_host.h" 23 #include "content/public/browser/render_frame_host.h"
20 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/site_instance.h" 26 #include "content/public/browser/site_instance.h"
23 #include "content/public/browser/ssl_status.h" 27 #include "content/public/browser/ssl_status.h"
24 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/origin_util.h"
26 #include "net/cert/cert_status_flags.h" 29 #include "net/cert/cert_status_flags.h"
27 #include "services/service_manager/public/cpp/interface_provider.h" 30 #include "services/service_manager/public/cpp/interface_provider.h"
28 31
29 namespace password_manager { 32 namespace password_manager {
30 33
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
43 ContentPasswordManagerDriver::ContentPasswordManagerDriver( 34 ContentPasswordManagerDriver::ContentPasswordManagerDriver(
44 content::RenderFrameHost* render_frame_host, 35 content::RenderFrameHost* render_frame_host,
45 PasswordManagerClient* client, 36 PasswordManagerClient* client,
46 autofill::AutofillClient* autofill_client) 37 autofill::AutofillClient* autofill_client)
47 : render_frame_host_(render_frame_host), 38 : render_frame_host_(render_frame_host),
48 client_(client), 39 client_(client),
49 password_generation_manager_(client, this), 40 password_generation_manager_(client, this),
50 password_autofill_manager_(this, autofill_client), 41 password_autofill_manager_(this, autofill_client),
51 next_free_key_(0), 42 next_free_key_(0),
52 password_manager_binding_(this), 43 password_manager_binding_(this),
53 weak_factory_(this) {} 44 weak_factory_(this) {
45 // Does nothing if a VisiblePasswordObserver has already been created
46 // for this WebContents.
47 VisiblePasswordObserver::CreateForWebContents(
48 content::WebContents::FromRenderFrameHost(render_frame_host_));
49 }
54 50
55 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { 51 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {
56 } 52 }
57 53
58 // static 54 // static
59 ContentPasswordManagerDriver* 55 ContentPasswordManagerDriver*
60 ContentPasswordManagerDriver::GetForRenderFrameHost( 56 ContentPasswordManagerDriver::GetForRenderFrameHost(
61 content::RenderFrameHost* render_frame_host) { 57 content::RenderFrameHost* render_frame_host) {
62 ContentPasswordManagerDriverFactory* factory = 58 ContentPasswordManagerDriverFactory* factory =
63 ContentPasswordManagerDriverFactory::FromWebContents( 59 ContentPasswordManagerDriverFactory::FromWebContents(
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 void ContentPasswordManagerDriver::OnFocusedPasswordFormFound( 197 void ContentPasswordManagerDriver::OnFocusedPasswordFormFound(
202 const autofill::PasswordForm& password_form) { 198 const autofill::PasswordForm& password_form) {
203 if (!CheckChildProcessSecurityPolicy( 199 if (!CheckChildProcessSecurityPolicy(
204 password_form.origin, 200 password_form.origin,
205 BadMessageReason::CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND)) 201 BadMessageReason::CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND))
206 return; 202 return;
207 GetPasswordManager()->OnPasswordFormForceSaveRequested(this, password_form); 203 GetPasswordManager()->OnPasswordFormForceSaveRequested(this, password_form);
208 } 204 }
209 205
210 void ContentPasswordManagerDriver::PasswordFieldVisibleInInsecureContext() { 206 void ContentPasswordManagerDriver::PasswordFieldVisibleInInsecureContext() {
211 MaybeNotifyPasswordInputShownOnHttp(render_frame_host_); 207 VisiblePasswordObserver* observer = VisiblePasswordObserver::FromWebContents(
208 content::WebContents::FromRenderFrameHost(render_frame_host_));
209 observer->RenderFrameHasVisiblePasswordField(render_frame_host_);
212 } 210 }
213 211
214 void ContentPasswordManagerDriver:: 212 void ContentPasswordManagerDriver::
215 AllPasswordFieldsInInsecureContextInvisible() { 213 AllPasswordFieldsInInsecureContextInvisible() {
216 // TODO(estark): if all frames in the frame tree have their password 214 VisiblePasswordObserver* observer = VisiblePasswordObserver::FromWebContents(
217 // fields hidden, then notify the WebContents that there are no 215 content::WebContents::FromRenderFrameHost(render_frame_host_));
218 // visible password fields left. https://crbug.com/658764 216 observer->RenderFrameHasNoVisiblePasswordFields(render_frame_host_);
219 } 217 }
220 218
221 void ContentPasswordManagerDriver::DidNavigateFrame( 219 void ContentPasswordManagerDriver::DidNavigateFrame(
222 const content::LoadCommittedDetails& details, 220 const content::LoadCommittedDetails& details,
223 const content::FrameNavigateParams& params) { 221 const content::FrameNavigateParams& params) {
224 // Clear page specific data after main frame navigation. 222 // Clear page specific data after main frame navigation.
225 if (!render_frame_host_->GetParent() && !details.is_in_page) { 223 if (!render_frame_host_->GetParent() && !details.is_in_page) {
226 GetPasswordManager()->DidNavigateMainFrame(); 224 GetPasswordManager()->DidNavigateMainFrame();
227 GetPasswordAutofillManager()->DidNavigateMainFrame(); 225 GetPasswordAutofillManager()->DidNavigateMainFrame();
228 } 226 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { 327 ContentPasswordManagerDriver::GetPasswordGenerationAgent() {
330 if (!password_gen_agent_) { 328 if (!password_gen_agent_) {
331 render_frame_host_->GetRemoteInterfaces()->GetInterface( 329 render_frame_host_->GetRemoteInterfaces()->GetInterface(
332 mojo::GetProxy(&password_gen_agent_)); 330 mojo::GetProxy(&password_gen_agent_));
333 } 331 }
334 332
335 return password_gen_agent_; 333 return password_gen_agent_;
336 } 334 }
337 335
338 } // namespace password_manager 336 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698