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) |
154 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, | 156 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, |
155 OnPasswordNoLongerGenerated) | 157 OnPasswordNoLongerGenerated) |
156 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, | 158 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, |
157 OnFocusedPasswordFormFound) | 159 OnFocusedPasswordFormFound) |
158 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, | 160 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, |
159 &password_autofill_manager_, | 161 &password_autofill_manager_, |
160 PasswordAutofillManager::OnShowPasswordSuggestions) | 162 PasswordAutofillManager::OnShowPasswordSuggestions) |
161 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, | 163 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, |
162 client_->GetLogManager(), | 164 client_->GetLogManager(), |
163 LogManager::LogSavePasswordProgress) | 165 LogManager::LogSavePasswordProgress) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 226 |
225 void ContentPasswordManagerDriver::OnInPageNavigation( | 227 void ContentPasswordManagerDriver::OnInPageNavigation( |
226 const autofill::PasswordForm& password_form) { | 228 const autofill::PasswordForm& password_form) { |
227 if (!CheckChildProcessSecurityPolicy( | 229 if (!CheckChildProcessSecurityPolicy( |
228 password_form.origin, | 230 password_form.origin, |
229 BadMessageReason::CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION)) | 231 BadMessageReason::CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION)) |
230 return; | 232 return; |
231 GetPasswordManager()->OnInPageNavigation(this, password_form); | 233 GetPasswordManager()->OnInPageNavigation(this, password_form); |
232 } | 234 } |
233 | 235 |
| 236 void ContentPasswordManagerDriver::OnPresaveGeneratedPassword( |
| 237 const autofill::PasswordForm& password_form) { |
| 238 if (!CheckChildProcessSecurityPolicy( |
| 239 password_form.origin, |
| 240 BadMessageReason::CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD)) |
| 241 return; |
| 242 GetPasswordManager()->OnPresaveGeneratedPassword(password_form); |
| 243 } |
| 244 |
234 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( | 245 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( |
235 const autofill::PasswordForm& password_form) { | 246 const autofill::PasswordForm& password_form) { |
236 if (!CheckChildProcessSecurityPolicy( | 247 if (!CheckChildProcessSecurityPolicy( |
237 password_form.origin, | 248 password_form.origin, |
238 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) | 249 BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) |
239 return; | 250 return; |
240 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, | 251 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, |
241 false); | 252 false); |
242 } | 253 } |
243 | 254 |
244 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( | 255 bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( |
245 const GURL& url, | 256 const GURL& url, |
246 BadMessageReason reason) { | 257 BadMessageReason reason) { |
247 content::ChildProcessSecurityPolicy* policy = | 258 content::ChildProcessSecurityPolicy* policy = |
248 content::ChildProcessSecurityPolicy::GetInstance(); | 259 content::ChildProcessSecurityPolicy::GetInstance(); |
249 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), | 260 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), |
250 url)) { | 261 url)) { |
251 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); | 262 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); |
252 return false; | 263 return false; |
253 } | 264 } |
254 | 265 |
255 return true; | 266 return true; |
256 } | 267 } |
257 | 268 |
258 } // namespace password_manager | 269 } // namespace password_manager |
OLD | NEW |