Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3439)

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter.cc

Issue 489103004: Allow editing passwords in settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/password_manager_presenter.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc
index 52d2eb80ef518a453732bff1da87088fde0da24f..08e27a4a041d2b32f9c9b23c4c6a21ecb94dadca 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -83,6 +83,28 @@ void PasswordManagerPresenter::UpdatePasswordLists() {
exception_populater_.Populate();
}
+void PasswordManagerPresenter::UpdatePassword(
+ size_t index,
+ const base::string16& password_value) {
+#if !defined(OS_ANDROID) // This is never called on Android.
+ if (index >= password_list_.size() || password_value.empty()) {
+ // |index| out of bounds might come from a compromised renderer, don't let
+ // it crash the browser. http://crbug.com/362054
+ // Similarly, empty |password_value| also might come from a compromised
+ // renderer, which is forbidden to be saved to the password store. So use
+ // the same logic.
+ NOTREACHED();
+ return;
+ }
+ PasswordStore* store = GetPasswordStore();
+ if (!store)
+ return;
+ autofill::PasswordForm form(*password_list_[index]);
+ form.password_value = password_value;
+ store->UpdateLogin(form);
+#endif
+}
+
void PasswordManagerPresenter::RemoveSavedPassword(size_t index) {
if (index >= password_list_.size()) {
// |index| out of bounds might come from a compromised renderer, don't let

Powered by Google App Engine
This is Rietveld 408576698