| OLD | NEW |
| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 client_(client), | 36 client_(client), |
| 37 password_generation_manager_(client, this), | 37 password_generation_manager_(client, this), |
| 38 password_autofill_manager_(this, autofill_client), | 38 password_autofill_manager_(this, autofill_client), |
| 39 next_free_key_(0), | 39 next_free_key_(0), |
| 40 password_manager_binding_(this), | 40 password_manager_binding_(this), |
| 41 weak_factory_(this) { | 41 weak_factory_(this) { |
| 42 // Does nothing if a VisiblePasswordObserver has already been created | 42 // Does nothing if a VisiblePasswordObserver has already been created |
| 43 // for this WebContents. | 43 // for this WebContents. |
| 44 VisiblePasswordObserver::CreateForWebContents( | 44 VisiblePasswordObserver::CreateForWebContents( |
| 45 content::WebContents::FromRenderFrameHost(render_frame_host_)); | 45 content::WebContents::FromRenderFrameHost(render_frame_host_)); |
| 46 |
| 47 // For some frames |this| may be instantiated before log manager creation, so |
| 48 // here we can not send logging state to renderer process for them. For such |
| 49 // cases, after the log manager got ready later, |
| 50 // ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability() will |
| 51 // call ContentPasswordManagerDriver::SendLoggingAvailability() on |this| to |
| 52 // do it actually. |
| 53 if (client_->GetLogManager()) { |
| 54 // Do not call the virtual method SendLoggingAvailability from a constructor |
| 55 // here, inline its steps instead. |
| 56 GetPasswordAutofillAgent()->SetLoggingState( |
| 57 client_->GetLogManager()->IsLoggingActive()); |
| 58 } |
| 46 } | 59 } |
| 47 | 60 |
| 48 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { | 61 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { |
| 49 } | 62 } |
| 50 | 63 |
| 51 // static | 64 // static |
| 52 ContentPasswordManagerDriver* | 65 ContentPasswordManagerDriver* |
| 53 ContentPasswordManagerDriver::GetForRenderFrameHost( | 66 ContentPasswordManagerDriver::GetForRenderFrameHost( |
| 54 content::RenderFrameHost* render_frame_host) { | 67 content::RenderFrameHost* render_frame_host) { |
| 55 ContentPasswordManagerDriverFactory* factory = | 68 ContentPasswordManagerDriverFactory* factory = |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 password_autofill_manager_.OnShowPasswordSuggestions( | 284 password_autofill_manager_.OnShowPasswordSuggestions( |
| 272 key, text_direction, typed_username, options, bounds); | 285 key, text_direction, typed_username, options, bounds); |
| 273 } | 286 } |
| 274 | 287 |
| 275 void ContentPasswordManagerDriver::ShowNotSecureWarning( | 288 void ContentPasswordManagerDriver::ShowNotSecureWarning( |
| 276 base::i18n::TextDirection text_direction, | 289 base::i18n::TextDirection text_direction, |
| 277 const gfx::RectF& bounds) { | 290 const gfx::RectF& bounds) { |
| 278 password_autofill_manager_.OnShowNotSecureWarning(text_direction, bounds); | 291 password_autofill_manager_.OnShowNotSecureWarning(text_direction, bounds); |
| 279 } | 292 } |
| 280 | 293 |
| 281 void ContentPasswordManagerDriver::PasswordAutofillAgentConstructed() { | |
| 282 SendLoggingAvailability(); | |
| 283 } | |
| 284 | |
| 285 void ContentPasswordManagerDriver::RecordSavePasswordProgress( | 294 void ContentPasswordManagerDriver::RecordSavePasswordProgress( |
| 286 const std::string& log) { | 295 const std::string& log) { |
| 287 client_->GetLogManager()->LogSavePasswordProgress(log); | 296 client_->GetLogManager()->LogSavePasswordProgress(log); |
| 288 } | 297 } |
| 289 | 298 |
| 290 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( | 299 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( |
| 291 const GURL& url, | 300 const GURL& url, |
| 292 BadMessageReason reason) { | 301 BadMessageReason reason) { |
| 293 content::ChildProcessSecurityPolicy* policy = | 302 content::ChildProcessSecurityPolicy* policy = |
| 294 content::ChildProcessSecurityPolicy::GetInstance(); | 303 content::ChildProcessSecurityPolicy::GetInstance(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { | 338 ContentPasswordManagerDriver::GetPasswordGenerationAgent() { |
| 330 if (!password_gen_agent_) { | 339 if (!password_gen_agent_) { |
| 331 render_frame_host_->GetRemoteInterfaces()->GetInterface( | 340 render_frame_host_->GetRemoteInterfaces()->GetInterface( |
| 332 mojo::MakeRequest(&password_gen_agent_)); | 341 mojo::MakeRequest(&password_gen_agent_)); |
| 333 } | 342 } |
| 334 | 343 |
| 335 return password_gen_agent_; | 344 return password_gen_agent_; |
| 336 } | 345 } |
| 337 | 346 |
| 338 } // namespace password_manager | 347 } // namespace password_manager |
| OLD | NEW |