| 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/content_password_manager_d
river_factory.h" | 10 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 content::RenderFrameHost* host = render_frame_host_; | 99 content::RenderFrameHost* host = render_frame_host_; |
| 100 host->Send(new AutofillMsg_PreviewPasswordSuggestion(host->GetRoutingID(), | 100 host->Send(new AutofillMsg_PreviewPasswordSuggestion(host->GetRoutingID(), |
| 101 username, password)); | 101 username, password)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ContentPasswordManagerDriver::ClearPreviewedForm() { | 104 void ContentPasswordManagerDriver::ClearPreviewedForm() { |
| 105 content::RenderFrameHost* host = render_frame_host_; | 105 content::RenderFrameHost* host = render_frame_host_; |
| 106 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | 106 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ContentPasswordManagerDriver::ForceSavePassword() { |
| 110 content::RenderFrameHost* host = render_frame_host_; |
| 111 host->Send(new AutofillMsg_FindFocusedPasswordForm(host->GetRoutingID())); |
| 112 } |
| 113 |
| 109 PasswordGenerationManager* | 114 PasswordGenerationManager* |
| 110 ContentPasswordManagerDriver::GetPasswordGenerationManager() { | 115 ContentPasswordManagerDriver::GetPasswordGenerationManager() { |
| 111 return &password_generation_manager_; | 116 return &password_generation_manager_; |
| 112 } | 117 } |
| 113 | 118 |
| 114 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { | 119 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { |
| 115 return client_->GetPasswordManager(); | 120 return client_->GetPasswordManager(); |
| 116 } | 121 } |
| 117 | 122 |
| 118 PasswordAutofillManager* | 123 PasswordAutofillManager* |
| 119 ContentPasswordManagerDriver::GetPasswordAutofillManager() { | 124 ContentPasswordManagerDriver::GetPasswordAutofillManager() { |
| 120 return &password_autofill_manager_; | 125 return &password_autofill_manager_; |
| 121 } | 126 } |
| 122 | 127 |
| 123 bool ContentPasswordManagerDriver::HandleMessage(const IPC::Message& message) { | 128 bool ContentPasswordManagerDriver::HandleMessage(const IPC::Message& message) { |
| 124 bool handled = true; | 129 bool handled = true; |
| 125 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message) | 130 IPC_BEGIN_MESSAGE_MAP(ContentPasswordManagerDriver, message) |
| 126 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed, | 131 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed, |
| 127 OnPasswordFormsParsed) | 132 OnPasswordFormsParsed) |
| 128 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered, | 133 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered, |
| 129 OnPasswordFormsRendered) | 134 OnPasswordFormsRendered) |
| 130 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, | 135 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted, |
| 131 OnPasswordFormSubmitted) | 136 OnPasswordFormSubmitted) |
| 132 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) | 137 IPC_MESSAGE_HANDLER(AutofillHostMsg_InPageNavigation, OnInPageNavigation) |
| 133 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, | 138 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordNoLongerGenerated, |
| 134 OnPasswordNoLongerGenerated) | 139 OnPasswordNoLongerGenerated) |
| 140 IPC_MESSAGE_HANDLER(AutofillHostMsg_FocusedPasswordFormFound, |
| 141 OnFocusedPasswordFormFound) |
| 135 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, | 142 IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions, |
| 136 &password_autofill_manager_, | 143 &password_autofill_manager_, |
| 137 PasswordAutofillManager::OnShowPasswordSuggestions) | 144 PasswordAutofillManager::OnShowPasswordSuggestions) |
| 138 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, client_, | 145 IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, client_, |
| 139 PasswordManagerClient::LogSavePasswordProgress) | 146 PasswordManagerClient::LogSavePasswordProgress) |
| 140 IPC_MESSAGE_UNHANDLED(handled = false) | 147 IPC_MESSAGE_UNHANDLED(handled = false) |
| 141 IPC_END_MESSAGE_MAP() | 148 IPC_END_MESSAGE_MAP() |
| 142 return handled; | 149 return handled; |
| 143 } | 150 } |
| 144 | 151 |
| 145 void ContentPasswordManagerDriver::OnPasswordFormsParsed( | 152 void ContentPasswordManagerDriver::OnPasswordFormsParsed( |
| 146 const std::vector<autofill::PasswordForm>& forms) { | 153 const std::vector<autofill::PasswordForm>& forms) { |
| 147 GetPasswordManager()->OnPasswordFormsParsed(this, forms); | 154 GetPasswordManager()->OnPasswordFormsParsed(this, forms); |
| 148 } | 155 } |
| 149 | 156 |
| 150 void ContentPasswordManagerDriver::OnPasswordFormsRendered( | 157 void ContentPasswordManagerDriver::OnPasswordFormsRendered( |
| 151 const std::vector<autofill::PasswordForm>& visible_forms, | 158 const std::vector<autofill::PasswordForm>& visible_forms, |
| 152 bool did_stop_loading) { | 159 bool did_stop_loading) { |
| 153 GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms, | 160 GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms, |
| 154 did_stop_loading); | 161 did_stop_loading); |
| 155 } | 162 } |
| 156 | 163 |
| 157 void ContentPasswordManagerDriver::OnPasswordFormSubmitted( | 164 void ContentPasswordManagerDriver::OnPasswordFormSubmitted( |
| 158 const autofill::PasswordForm& password_form) { | 165 const autofill::PasswordForm& password_form) { |
| 159 GetPasswordManager()->OnPasswordFormSubmitted(this, password_form); | 166 GetPasswordManager()->OnPasswordFormSubmitted(this, password_form); |
| 160 } | 167 } |
| 161 | 168 |
| 169 void ContentPasswordManagerDriver::OnFocusedPasswordFormFound( |
| 170 const autofill::PasswordForm& password_form) { |
| 171 GetPasswordManager()->OnPasswordFormForceSaveRequested(this, password_form); |
| 172 } |
| 173 |
| 162 void ContentPasswordManagerDriver::DidNavigateFrame( | 174 void ContentPasswordManagerDriver::DidNavigateFrame( |
| 163 const content::LoadCommittedDetails& details, | 175 const content::LoadCommittedDetails& details, |
| 164 const content::FrameNavigateParams& params) { | 176 const content::FrameNavigateParams& params) { |
| 165 // Clear page specific data after main frame navigation. | 177 // Clear page specific data after main frame navigation. |
| 166 if (!render_frame_host_->GetParent() && !details.is_in_page) { | 178 if (!render_frame_host_->GetParent() && !details.is_in_page) { |
| 167 GetPasswordManager()->DidNavigateMainFrame(); | 179 GetPasswordManager()->DidNavigateMainFrame(); |
| 168 GetPasswordAutofillManager()->DidNavigateMainFrame(); | 180 GetPasswordAutofillManager()->DidNavigateMainFrame(); |
| 169 } | 181 } |
| 170 } | 182 } |
| 171 | 183 |
| 172 void ContentPasswordManagerDriver::OnInPageNavigation( | 184 void ContentPasswordManagerDriver::OnInPageNavigation( |
| 173 const autofill::PasswordForm& password_form) { | 185 const autofill::PasswordForm& password_form) { |
| 174 GetPasswordManager()->OnInPageNavigation(this, password_form); | 186 GetPasswordManager()->OnInPageNavigation(this, password_form); |
| 175 } | 187 } |
| 176 | 188 |
| 177 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( | 189 void ContentPasswordManagerDriver::OnPasswordNoLongerGenerated( |
| 178 const autofill::PasswordForm& password_form) { | 190 const autofill::PasswordForm& password_form) { |
| 179 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, | 191 GetPasswordManager()->SetHasGeneratedPasswordForForm(this, password_form, |
| 180 false); | 192 false); |
| 181 } | 193 } |
| 182 | 194 |
| 183 } // namespace password_manager | 195 } // namespace password_manager |
| OLD | NEW |