| 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 "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Here, |credential_type| refers to whether the credential was originally | 211 // Here, |credential_type| refers to whether the credential was originally |
| 212 // passed into ::OnChooseCredentials as part of the |local_credentials| or | 212 // passed into ::OnChooseCredentials as part of the |local_credentials| or |
| 213 // |federated_credentials| lists (e.g. whether it is an existing credential | 213 // |federated_credentials| lists (e.g. whether it is an existing credential |
| 214 // saved for this origin, or whether we should synthesize a new | 214 // saved for this origin, or whether we should synthesize a new |
| 215 // FederatedCredential). | 215 // FederatedCredential). |
| 216 // | 216 // |
| 217 // If |credential_type| is federated, the credential MUST be returned as | 217 // If |credential_type| is federated, the credential MUST be returned as |
| 218 // a FederatedCredential in order to prevent password information leaking | 218 // a FederatedCredential in order to prevent password information leaking |
| 219 // cross-origin. | 219 // cross-origin. |
| 220 // | 220 // |
| 221 // If |credential_type| is local, the credential MIGHT be a LocalCredential | 221 // If |credential_type| is local, the credential MIGHT be a PasswordCredential |
| 222 // or it MIGHT be a FederatedCredential. We inspect the |federation_url| | 222 // or it MIGHT be a FederatedCredential. We inspect the |federation_url| |
| 223 // field to determine which we should return. | 223 // field to determine which we should return. |
| 224 // | 224 // |
| 225 // TODO(mkwst): Clean this up. It is confusing. | 225 // TODO(mkwst): Clean this up. It is confusing. |
| 226 password_manager::CredentialType type_to_return; | 226 password_manager::CredentialType type_to_return; |
| 227 if (credential_type == | 227 if (credential_type == |
| 228 password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL && | 228 password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD && |
| 229 form.federation_url.is_empty()) { | 229 form.federation_url.is_empty()) { |
| 230 type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL; | 230 type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD; |
| 231 } else if (credential_type == | 231 } else if (credential_type == |
| 232 password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY) { | 232 password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY) { |
| 233 type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY; | 233 type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY; |
| 234 } else { | 234 } else { |
| 235 type_to_return = | 235 type_to_return = |
| 236 password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED; | 236 password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED; |
| 237 } | 237 } |
| 238 password_manager::CredentialInfo info = | 238 password_manager::CredentialInfo info = |
| 239 password_manager::CredentialInfo(form, type_to_return); | 239 password_manager::CredentialInfo(form, type_to_return); |
| 240 passwords_data_.credentials_callback().Run(info); | 240 passwords_data_.credentials_callback().Run(info); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 361 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
| 362 #endif | 362 #endif |
| 363 } | 363 } |
| 364 | 364 |
| 365 void ManagePasswordsUIController::WebContentsDestroyed() { | 365 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 366 password_manager::PasswordStore* password_store = | 366 password_manager::PasswordStore* password_store = |
| 367 GetPasswordStore(web_contents()); | 367 GetPasswordStore(web_contents()); |
| 368 if (password_store) | 368 if (password_store) |
| 369 password_store->RemoveObserver(this); | 369 password_store->RemoveObserver(this); |
| 370 } | 370 } |
| OLD | NEW |