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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/password_manager_presenter.h" 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/user_metrics_action.h" 9 #include "base/metrics/user_metrics_action.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 last_authentication_time_ = base::TimeTicks(); 76 last_authentication_time_ = base::TimeTicks();
77 77
78 // Reset the current lists. 78 // Reset the current lists.
79 password_list_.clear(); 79 password_list_.clear();
80 password_exception_list_.clear(); 80 password_exception_list_.clear();
81 81
82 populater_.Populate(); 82 populater_.Populate();
83 exception_populater_.Populate(); 83 exception_populater_.Populate();
84 } 84 }
85 85
86 void PasswordManagerPresenter::UpdatePassword(
87 size_t index,
88 const base::string16& password_value) {
89 #if !defined(OS_ANDROID) // This is never called on Android.
90 if (index >= password_list_.size() || password_value.empty()) {
91 // |index| out of bounds might come from a compromised renderer, don't let
92 // it crash the browser. http://crbug.com/362054
93 // Similarly, empty |password_value| also might come from a compromised
94 // renderer, which is forbidden to be saved to the password store. So use
95 // the same logic.
96 NOTREACHED();
97 return;
98 }
99 PasswordStore* store = GetPasswordStore();
100 if (!store)
101 return;
102 autofill::PasswordForm form(*password_list_[index]);
103 form.password_value = password_value;
104 store->UpdateLogin(form);
105 #endif
106 }
107
86 void PasswordManagerPresenter::RemoveSavedPassword(size_t index) { 108 void PasswordManagerPresenter::RemoveSavedPassword(size_t index) {
87 if (index >= password_list_.size()) { 109 if (index >= password_list_.size()) {
88 // |index| out of bounds might come from a compromised renderer, don't let 110 // |index| out of bounds might come from a compromised renderer, don't let
89 // it crash the browser. http://crbug.com/362054 111 // it crash the browser. http://crbug.com/362054
90 NOTREACHED(); 112 NOTREACHED();
91 return; 113 return;
92 } 114 }
93 PasswordStore* store = GetPasswordStore(); 115 PasswordStore* store = GetPasswordStore();
94 if (!store) 116 if (!store)
95 return; 117 return;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 254 }
233 255
234 void PasswordManagerPresenter::PasswordExceptionListPopulater:: 256 void PasswordManagerPresenter::PasswordExceptionListPopulater::
235 OnGetPasswordStoreResults( 257 OnGetPasswordStoreResults(
236 const std::vector<autofill::PasswordForm*>& results) { 258 const std::vector<autofill::PasswordForm*>& results) {
237 page_->password_exception_list_.clear(); 259 page_->password_exception_list_.clear();
238 page_->password_exception_list_.insert(page_->password_exception_list_.end(), 260 page_->password_exception_list_.insert(page_->password_exception_list_.end(),
239 results.begin(), results.end()); 261 results.begin(), results.end());
240 page_->SetPasswordExceptionList(); 262 page_->SetPasswordExceptionList();
241 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698