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" |
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::SendLoggingAvailability() { |
| 119 render_frame_host_->Send(new AutofillMsg_SetLoggingState( |
| 120 render_frame_host_->GetRoutingID(), |
| 121 client_->GetLogManager()->IsLoggingActive())); |
| 122 } |
| 123 |
117 PasswordGenerationManager* | 124 PasswordGenerationManager* |
118 ContentPasswordManagerDriver::GetPasswordGenerationManager() { | 125 ContentPasswordManagerDriver::GetPasswordGenerationManager() { |
119 return &password_generation_manager_; | 126 return &password_generation_manager_; |
120 } | 127 } |
121 | 128 |
122 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { | 129 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { |
123 return client_->GetPasswordManager(); | 130 return client_->GetPasswordManager(); |
124 } | 131 } |
125 | 132 |
126 PasswordAutofillManager* | 133 PasswordAutofillManager* |
(...skipping 11 matching lines...) Expand all Loading... |
138 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, | 145 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, |
139 OnPasswordFormSubmitted) | 146 OnPasswordFormSubmitted) |
140 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) | 147 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) |
141 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, | 148 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, |
142 OnPasswordNoLongerGenerated) | 149 OnPasswordNoLongerGenerated) |
143 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, | 150 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, |
144 OnFocusedPasswordFormFound) | 151 OnFocusedPasswordFormFound) |
145 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, | 152 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, |
146 &password_autofill_manager_, | 153 &password_autofill_manager_, |
147 PasswordAutofillManager::OnShowPasswordSuggestions) | 154 PasswordAutofillManager::OnShowPasswordSuggestions) |
148 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, client_, | 155 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, |
149 PasswordManagerClient::LogSavePasswordProgress) | 156 client_->GetLogManager(), |
| 157 LogManager::LogSavePasswordProgress) |
| 158 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed, |
| 159 SendLoggingAvailability) |
150 IPC_MESSAGE_UNHANDLED(handled = false) | 160 IPC_MESSAGE_UNHANDLED(handled = false) |
151 IPC_END_MESSAGE_MAP() | 161 IPC_END_MESSAGE_MAP() |
152 return handled; | 162 return handled; |
153 } | 163 } |
154 | 164 |
155 void ContentPasswordManagerDriver::OnPasswordFormsParsed( | 165 void ContentPasswordManagerDriver::OnPasswordFormsParsed( |
156 const std::vector<autofill::PasswordForm>& forms) { | 166 const std::vector<autofill::PasswordForm>& forms) { |
157 for (const auto& form : forms) | 167 for (const auto& form : forms) |
158 if (!CheckChildProcessSecurityPolicy( | 168 if (!CheckChildProcessSecurityPolicy( |
159 form.origin, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) | 169 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(), | 243 if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), |
234 url)) { | 244 url)) { |
235 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); | 245 bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); |
236 return false; | 246 return false; |
237 } | 247 } |
238 | 248 |
239 return true; | 249 return true; |
240 } | 250 } |
241 | 251 |
242 } // namespace password_manager | 252 } // namespace password_manager |
OLD | NEW |