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