summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:48:55 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 01:48:55 +0000
commitceed72954b3444d1f06468a2edc6fe41aeb8f012 (patch)
tree1bf3aaa965f4db6f5488f19ada15b9ac910411de
parent5321187fdfa331bbc7375f6ecb5ed2b5efb6c0e8 (diff)
downloadchromium_src-ceed72954b3444d1f06468a2edc6fe41aeb8f012.zip
chromium_src-ceed72954b3444d1f06468a2edc6fe41aeb8f012.tar.gz
chromium_src-ceed72954b3444d1f06468a2edc6fe41aeb8f012.tar.bz2
Implements a method to enable/disable the "Remove All" button
in the password manager. This method is called whenever the password manager window is opened and disables the button if there are no passwords stored. It is also called when all of the stored passwords are removed. BUG=7228 Original patch by Kyle Nahrgang <kpn24@drexel.edu> in http://codereview.chromium.org/28063/show Review URL: http://codereview.chromium.org/27191 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10435 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--chrome/browser/views/password_manager_view.cc7
-rw-r--r--chrome/browser/views/password_manager_view.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 7a5e29f..ea40fd9 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -28,3 +28,4 @@ Joshua Roesslein <jroesslein@gmail.com>
Yong Shin <sy3620@gmail.com>
Laszlo Radanyi <bekkra@gmail.com>
Raman Tenneti <raman.tenneti@gmail.com>
+Kyle Nahrgang <kpn24@drexel.edu> \ No newline at end of file
diff --git a/chrome/browser/views/password_manager_view.cc b/chrome/browser/views/password_manager_view.cc
index 644e09f..bdc877d 100644
--- a/chrome/browser/views/password_manager_view.cc
+++ b/chrome/browser/views/password_manager_view.cc
@@ -135,6 +135,7 @@ void PasswordManagerTableModel::OnWebDataServiceRequestDone(
saved_signons_[i] = new PasswordRow(
gfx::SortedDisplayURL(rows[i]->origin, languages), rows[i]);
}
+ instance_->SetRemoveAllEnabled(RowCount() != 0);
if (observer_)
observer_->OnModelChanged();
}
@@ -159,6 +160,7 @@ void PasswordManagerTableModel::ForgetAndRemoveSignon(int row) {
web_data_service()->RemoveLogin(*(password_row->form.get()));
delete password_row;
saved_signons_.erase(target_iter);
+ instance_->SetRemoveAllEnabled(RowCount() != 0);
if (observer_)
observer_->OnItemsRemoved(row, 1);
}
@@ -172,6 +174,7 @@ void PasswordManagerTableModel::ForgetAndRemoveAllSignons() {
delete row;
iter = saved_signons_.erase(iter);
}
+ instance_->SetRemoveAllEnabled(false);
if (observer_)
observer_->OnModelChanged();
}
@@ -355,6 +358,10 @@ std::wstring PasswordManagerView::GetWindowTitle() const {
return l10n_util::GetString(IDS_PASSWORD_MANAGER_VIEW_TITLE);
}
+void PasswordManagerView::SetRemoveAllEnabled(bool enabled) {
+ instance_->remove_all_button_.SetEnabled(enabled);
+}
+
void PasswordManagerView::ButtonPressed(views::NativeButton* sender) {
DCHECK(window());
// Close will result in our destruction.
diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h
index c3a1b1a..a43b9f3 100644
--- a/chrome/browser/views/password_manager_view.h
+++ b/chrome/browser/views/password_manager_view.h
@@ -121,6 +121,7 @@ class PasswordManagerView : public views::View,
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
views::View* child);
+ virtual void SetRemoveAllEnabled(bool enabled);
// views::TableViewObserver implementation.
virtual void OnSelectionChanged();