| 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" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 bool ContentPasswordManagerDriver::HandleMessage(const IPC::Message& message) { | 144 bool ContentPasswordManagerDriver::HandleMessage(const IPC::Message& message) { |
| 145 bool handled = true; | 145 bool handled = true; |
| 146 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message) | 146 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message) |
| 147 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed, | 147 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed, |
| 148 OnPasswordFormsParsed) | 148 OnPasswordFormsParsed) |
| 149 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered, | 149 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered, |
| 150 OnPasswordFormsRendered) | 150 OnPasswordFormsRendered) |
| 151 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, | 151 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, |
| 152 OnPasswordFormSubmitted) | 152 OnPasswordFormSubmitted) |
| 153 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) | 153 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) |
| 154 IPC_MESSAGE_HANDLER(AutofillHostMsg_PresaveGeneratedPassword, |
| 155 OnPresaveGeneratedPassword) |
| 156 IPC_MESSAGE_HANDLER(AutofillHostMsg_UpdatePresavedPassword, |
| 157 OnUpdatePresavedPassword) |
| 154 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, | 158 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, |
| 155 OnPasswordNoLongerGenerated) | 159 OnPasswordNoLongerGenerated) |
| 156 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, | 160 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, |
| 157 OnFocusedPasswordFormFound) | 161 OnFocusedPasswordFormFound) |
| 158 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, | 162 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, |
| 159 &password_autofill_manager_, | 163 &password_autofill_manager_, |
| 160 PasswordAutofillManager::OnShowPasswordSuggestions) | 164 PasswordAutofillManager::OnShowPasswordSuggestions) |
| 161 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, | 165 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, |
| 162 client_->GetLogManager(), | 166 client_->GetLogManager(), |
| 163 LogManager::LogSavePasswordProgress) | 167 LogManager::LogSavePasswordProgress) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 228 |
| 225 void ContentPasswordManagerDriver::OnInPageNavigation( | 229 void ContentPasswordManagerDriver::OnInPageNavigation( |
| 226 const autofill::PasswordForm& password_form) { | 230 const autofill::PasswordForm& password_form) { |
| 227 if (!CheckChildProcessSecurityPolicy( | 231 if (!CheckChildProcessSecurityPolicy( |
| 228 password_form.origin, | 232 password_form.origin, |
| 229 BadMessageReason::CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION)) | 233 BadMessageReason::CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION)) |
| 230 return; | 234 return; |
| 231 GetPasswordManager()->OnInPageNavigation(this, password_form); | 235 GetPasswordManager()->OnInPageNavigation(this, password_form); |
| 232 } | 236 } |
| 233 | 237 |
| 238 void ContentPasswordManagerDriver::OnPresaveGeneratedPassword( |
| 239 const autofill::PasswordForm& password_form) { |
| 240 if (!CheckChildProcessSecurityPolicy( |
| 241 password_form.origin, |
| 242 BadMessageReason::CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD)) |
| 243 return; |
| 244 GetPasswordManager()->OnPresaveGeneratedPassword(password_form); |
| 245 } |
| 246 |
| 247 void ContentPasswordManagerDriver::OnUpdatePresavedPassword( |
| 248 const autofill::PasswordForm& password_form) { |
| 249 if (!CheckChildProcessSecurityPolicy( |
| 250 password_form.origin, |
| 251 BadMessageReason::CPMD_BAD_ORIGIN_UPDATE_PRESAVED_PASSWORD)) |
| 252 return; |
| 253 GetPasswordManager()->OnUpdatePresavedPassword(password_form); |
| 254 } |
| 255 |
| 234 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( | 256 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( |
| 235 const autofill::PasswordForm& password_form) { | 257 const autofill::PasswordForm& password_form) { |
| 236 if (!CheckChildProcessSecurityPolicy( | 258 if (!CheckChildProcessSecurityPolicy( |
| 237 password_form.origin, | 259 password_form.origin, |
| 238 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) | 260 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) |
| 239 return; | 261 return; |
| 240 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, | 262 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, |
| 241 false); | 263 false); |
| 242 } | 264 } |
| 243 | 265 |
| 244 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( | 266 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( |
| 245 const GURL& url, | 267 const GURL& url, |
| 246 BadMessageReason reason) { | 268 BadMessageReason reason) { |
| 247 content::ChildProcessSecurityPolicy* policy = | 269 content::ChildProcessSecurityPolicy* policy = |
| 248 content::ChildProcessSecurityPolicy::GetInstance(); | 270 content::ChildProcessSecurityPolicy::GetInstance(); |
| 249 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), | 271 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), |
| 250 url)) { | 272 url)) { |
| 251 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); | 273 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); |
| 252 return false; | 274 return false; |
| 253 } | 275 } |
| 254 | 276 |
| 255 return true; | 277 return true; |
| 256 } | 278 } |
| 257 | 279 |
| 258 } // namespace password_manager | 280 } // namespace password_manager |
| OLD | NEW |