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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter.cc

Issue 71003002: Merge browser/ui/password and browser/ui/passwords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | Annotate | Revision Log
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/webui/options/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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/password_manager/password_manager_util.h" 12 #include "chrome/browser/password_manager/password_manager_util.h"
13 #include "chrome/browser/password_manager/password_store_factory.h" 13 #include "chrome/browser/password_manager/password_store_factory.h"
14 #include "chrome/browser/ui/password/password_ui_view.h" 14 #include "chrome/browser/ui/passwords/password_ui_view.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "components/autofill/core/common/password_form.h" 18 #include "components/autofill/core/common/password_form.h"
19 #include "content/public/browser/user_metrics.h" 19 #include "content/public/browser/user_metrics.h"
20 20
21 namespace options {
22
23 PasswordManagerPresenter::PasswordManagerPresenter( 21 PasswordManagerPresenter::PasswordManagerPresenter(
24 passwords_ui::PasswordUIView* password_view) 22 PasswordUIView* password_view)
25 : populater_(this), 23 : populater_(this),
26 exception_populater_(this), 24 exception_populater_(this),
27 password_view_(password_view) { 25 password_view_(password_view) {
28 DCHECK(password_view_); 26 DCHECK(password_view_);
29 require_reauthentication_ = CommandLine::ForCurrentProcess()->HasSwitch( 27 require_reauthentication_ = CommandLine::ForCurrentProcess()->HasSwitch(
30 switches::kEnablePasswordManagerReauthentication); 28 switches::kEnablePasswordManagerReauthentication);
31 } 29 }
32 30
33 PasswordManagerPresenter::~PasswordManagerPresenter() { 31 PasswordManagerPresenter::~PasswordManagerPresenter() {
34 PasswordStore* store = GetPasswordStore(); 32 PasswordStore* store = GetPasswordStore();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 65
68 void PasswordManagerPresenter::UpdatePasswordLists() { 66 void PasswordManagerPresenter::UpdatePasswordLists() {
69 // Reset the current lists. 67 // Reset the current lists.
70 password_list_.clear(); 68 password_list_.clear();
71 password_exception_list_.clear(); 69 password_exception_list_.clear();
72 70
73 populater_.Populate(); 71 populater_.Populate();
74 exception_populater_.Populate(); 72 exception_populater_.Populate();
75 } 73 }
76 74
77 void PasswordManagerPresenter::HandleRemoveSavedPassword(size_t index) { 75 void PasswordManagerPresenter::RemoveSavedPassword(size_t index) {
78 DCHECK_LT(index, password_list_.size()); 76 DCHECK_LT(index, password_list_.size());
79 PasswordStore* store = GetPasswordStore(); 77 PasswordStore* store = GetPasswordStore();
80 if (!store) 78 if (!store)
81 return; 79 return;
82 store->RemoveLogin(*password_list_[index]); 80 store->RemoveLogin(*password_list_[index]);
83 content::RecordAction( 81 content::RecordAction(
84 content::UserMetricsAction("PasswordManager_HandleRemoveSavedPassword")); 82 content::UserMetricsAction("PasswordManager_RemoveSavedPassword"));
85 } 83 }
86 84
87 void PasswordManagerPresenter::HandleRemovePasswordException(size_t index) { 85 void PasswordManagerPresenter::RemovePasswordException(size_t index) {
88 DCHECK_LT(index, password_exception_list_.size()); 86 DCHECK_LT(index, password_exception_list_.size());
89 PasswordStore* store = GetPasswordStore(); 87 PasswordStore* store = GetPasswordStore();
90 if (!store) 88 if (!store)
91 return; 89 return;
92 store->RemoveLogin(*password_exception_list_[index]); 90 store->RemoveLogin(*password_exception_list_[index]);
93 content::RecordAction( 91 content::RecordAction(
94 content::UserMetricsAction( 92 content::UserMetricsAction(
95 "PasswordManager_HandleRemovePasswordException")); 93 "PasswordManager_RemovePasswordException"));
96 } 94 }
97 95
98 void PasswordManagerPresenter::HandleRequestShowPassword(size_t index) { 96 void PasswordManagerPresenter::RequestShowPassword(size_t index) {
99 DCHECK_LT(index, password_list_.size()); 97 DCHECK_LT(index, password_list_.size());
100 if (IsAuthenticationRequired()) { 98 if (IsAuthenticationRequired()) {
101 if (password_manager_util::AuthenticateUser()) 99 if (password_manager_util::AuthenticateUser())
102 last_authentication_time_ = base::TimeTicks::Now(); 100 last_authentication_time_ = base::TimeTicks::Now();
103 else 101 else
104 return; 102 return;
105 } 103 }
106 // Call back the front end to reveal the password. 104 // Call back the front end to reveal the password.
107 password_view_->ShowPassword(index, password_list_[index]->password_value); 105 password_view_->ShowPassword(index, password_list_[index]->password_value);
108 } 106 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 page_->SetPasswordExceptionList(); 213 page_->SetPasswordExceptionList();
216 } 214 }
217 215
218 void PasswordManagerPresenter::PasswordExceptionListPopulater:: 216 void PasswordManagerPresenter::PasswordExceptionListPopulater::
219 OnGetPasswordStoreResults( 217 OnGetPasswordStoreResults(
220 const std::vector<autofill::PasswordForm*>& results) { 218 const std::vector<autofill::PasswordForm*>& results) {
221 // TODO(kaiwang): Implement when I refactor 219 // TODO(kaiwang): Implement when I refactor
222 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins. 220 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins.
223 NOTIMPLEMENTED(); 221 NOTIMPLEMENTED();
224 } 222 }
225
226 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698