Chromium Code Reviews| 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/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" |
| 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" | |
| 13 #include "components/password_manager/core/browser/password_manager.h" | |
|
vasilii
2015/11/13 12:17:31
Why do you need this guy here?
vabr (Chromium)
2015/11/13 20:48:18
Line 184 (existing code) calls a method of the Pas
| |
| 12 #include "components/password_manager/core/browser/password_manager_client.h" | 14 #include "components/password_manager/core/browser/password_manager_client.h" |
| 13 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/child_process_security_policy.h" | 16 #include "content/public/browser/child_process_security_policy.h" |
| 15 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
| 16 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
| 17 #include "content/public/browser/render_frame_host.h" | 19 #include "content/public/browser/render_frame_host.h" |
| 18 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
| 19 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/site_instance.h" | 22 #include "content/public/browser/site_instance.h" |
| 21 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/common/ssl_status.h" | 24 #include "content/public/common/ssl_status.h" |
| 23 #include "ipc/ipc_message_macros.h" | 25 #include "ipc/ipc_message_macros.h" |
| 24 #include "net/cert/cert_status_flags.h" | 26 #include "net/cert/cert_status_flags.h" |
| 25 | 27 |
| 26 namespace password_manager { | 28 namespace password_manager { |
| 27 | 29 |
| 28 ContentPasswordManagerDriver::ContentPasswordManagerDriver( | 30 ContentPasswordManagerDriver::ContentPasswordManagerDriver( |
| 29 content::RenderFrameHost* render_frame_host, | 31 content::RenderFrameHost* render_frame_host, |
| 30 PasswordManagerClient* client, | 32 PasswordManagerClient* client, |
| 31 autofill::AutofillClient* autofill_client) | 33 autofill::AutofillClient* autofill_client) |
| 32 : render_frame_host_(render_frame_host), | 34 : render_frame_host_(render_frame_host), |
| 33 client_(client), | 35 client_(client), |
| 34 password_generation_manager_(client, this), | 36 password_generation_manager_(client, this), |
| 35 password_autofill_manager_(this, autofill_client), | 37 password_autofill_manager_(this, autofill_client), |
| 36 next_free_key_(0) { | 38 next_free_key_(0) {} |
| 37 } | |
| 38 | 39 |
| 39 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { | 40 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { |
| 40 } | 41 } |
| 41 | 42 |
| 42 // static | 43 // static |
| 43 ContentPasswordManagerDriver* | 44 ContentPasswordManagerDriver* |
| 44 ContentPasswordManagerDriver::GetForRenderFrameHost( | 45 ContentPasswordManagerDriver::GetForRenderFrameHost( |
| 45 content::RenderFrameHost* render_frame_host) { | 46 content::RenderFrameHost* render_frame_host) { |
| 46 ContentPasswordManagerDriverFactory* factory = | 47 ContentPasswordManagerDriverFactory* factory = |
| 47 ContentPasswordManagerDriverFactory::FromWebContents( | 48 ContentPasswordManagerDriverFactory::FromWebContents( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 void ContentPasswordManagerDriver::ClearPreviewedForm() { | 108 void ContentPasswordManagerDriver::ClearPreviewedForm() { |
| 108 content::RenderFrameHost* host = render_frame_host_; | 109 content::RenderFrameHost* host = render_frame_host_; |
| 109 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | 110 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void ContentPasswordManagerDriver::ForceSavePassword() { | 113 void ContentPasswordManagerDriver::ForceSavePassword() { |
| 113 content::RenderFrameHost* host = render_frame_host_; | 114 content::RenderFrameHost* host = render_frame_host_; |
| 114 host->Send(new AutofillMsg_FindFocusedPasswordForm(host->GetRoutingID())); | 115 host->Send(new AutofillMsg_FindFocusedPasswordForm(host->GetRoutingID())); |
| 115 } | 116 } |
| 116 | 117 |
| 118 void ContentPasswordManagerDriver::NotifyAboutLoggingAvailability( | |
| 119 bool is_available) { | |
| 120 if (is_available == logging_available_) | |
| 121 return; | |
| 122 logging_available_ = is_available; | |
| 123 SendLoggingAvailability(); | |
| 124 } | |
| 125 | |
| 126 void ContentPasswordManagerDriver::SendLoggingAvailability() { | |
|
vasilii
2015/11/13 12:17:31
Declaration order should match the definition orde
vabr (Chromium)
2015/11/13 20:48:18
Done.
| |
| 127 render_frame_host_->Send(new AutofillMsg_SetLoggingState( | |
| 128 render_frame_host_->GetRoutingID(), logging_available_)); | |
| 129 } | |
| 130 | |
| 117 PasswordGenerationManager* | 131 PasswordGenerationManager* |
| 118 ContentPasswordManagerDriver::GetPasswordGenerationManager() { | 132 ContentPasswordManagerDriver::GetPasswordGenerationManager() { |
| 119 return &password_generation_manager_; | 133 return &password_generation_manager_; |
| 120 } | 134 } |
| 121 | 135 |
| 122 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { | 136 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { |
| 123 return client_->GetPasswordManager(); | 137 return client_->GetPasswordManager(); |
| 124 } | 138 } |
| 125 | 139 |
| 126 PasswordAutofillManager* | 140 PasswordAutofillManager* |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 138 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, | 152 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, |
| 139 OnPasswordFormSubmitted) | 153 OnPasswordFormSubmitted) |
| 140 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) | 154 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) |
| 141 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, | 155 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, |
| 142 OnPasswordNoLongerGenerated) | 156 OnPasswordNoLongerGenerated) |
| 143 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, | 157 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, |
| 144 OnFocusedPasswordFormFound) | 158 OnFocusedPasswordFormFound) |
| 145 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, | 159 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, |
| 146 &password_autofill_manager_, | 160 &password_autofill_manager_, |
| 147 PasswordAutofillManager::OnShowPasswordSuggestions) | 161 PasswordAutofillManager::OnShowPasswordSuggestions) |
| 148 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, client_, | 162 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, |
| 149 PasswordManagerClient::LogSavePasswordProgress) | 163 client_->GetLogManager(), |
| 164 LogManager::LogSavePasswordProgress) | |
| 165 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed, | |
| 166 SendLoggingAvailability) | |
| 150 IPC_MESSAGE_UNHANDLED(handled = false) | 167 IPC_MESSAGE_UNHANDLED(handled = false) |
| 151 IPC_END_MESSAGE_MAP() | 168 IPC_END_MESSAGE_MAP() |
| 152 return handled; | 169 return handled; |
| 153 } | 170 } |
| 154 | 171 |
| 155 void ContentPasswordManagerDriver::OnPasswordFormsParsed( | 172 void ContentPasswordManagerDriver::OnPasswordFormsParsed( |
| 156 const std::vector<autofill::PasswordForm>& forms) { | 173 const std::vector<autofill::PasswordForm>& forms) { |
| 157 for (const auto& form : forms) | 174 for (const auto& form : forms) |
| 158 if (!CheckChildProcessSecurityPolicy( | 175 if (!CheckChildProcessSecurityPolicy( |
| 159 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) | 176 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), | 250 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), |
| 234 url)) { | 251 url)) { |
| 235 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); | 252 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); |
| 236 return false; | 253 return false; |
| 237 } | 254 } |
| 238 | 255 |
| 239 return true; | 256 return true; |
| 240 } | 257 } |
| 241 | 258 |
| 242 } // namespace password_manager | 259 } // namespace password_manager |
| OLD | NEW |