| Index: chrome/browser/views/password_manager_view.h
|
| diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h
|
| index a5e59505c46957d19e4359ff9dfc41bc8c2a8a37..6454db0bcaec4f770f70e1a2ba037822dd2734d8 100644
|
| --- a/chrome/browser/views/password_manager_view.h
|
| +++ b/chrome/browser/views/password_manager_view.h
|
| @@ -20,6 +20,21 @@
|
|
|
| class Profile;
|
|
|
| +// An observer interface to notify change of row count in a table model. This
|
| +// allow the container view of TableView(i.e. PasswordManagerView and
|
| +// PasswordManagerExceptionsView), to be notified of row count changes directly
|
| +// from the TableModel. We have two different observers in
|
| +// PasswordManagerTableModel, namely views::TableModelObserver and
|
| +// PasswordManagerTableModelObserver, rather than adding this event to
|
| +// views::TableModelObserver because only container view of
|
| +// PasswordManagerTableModel cares about this event. Because of the same reason
|
| +// the relationship between a PasswordManagerTableModel and
|
| +// PasswordManagerTableModelObserver is 1-to-1.
|
| +class PasswordManagerTableModelObserver {
|
| + public:
|
| + virtual void OnRowCountChanged(size_t rows) = 0;
|
| +};
|
| +
|
| class PasswordManagerTableModel : public views::TableModel,
|
| public WebDataServiceConsumer {
|
| public:
|
| @@ -49,6 +64,11 @@ class PasswordManagerTableModel : public views::TableModel,
|
| // Return the PasswordForm at the specified index.
|
| PasswordForm* GetPasswordFormAt(int row);
|
|
|
| + // Set the observer who concerns about how many rows are in the table.
|
| + void set_row_count_observer(PasswordManagerTableModelObserver* observer) {
|
| + row_count_observer_ = observer;
|
| + }
|
| +
|
| protected:
|
| // Wraps the PasswordForm from the database and caches the display URL for
|
| // quick sorting.
|
| @@ -72,6 +92,10 @@ class PasswordManagerTableModel : public views::TableModel,
|
| // The TableView observing this model.
|
| views::TableModelObserver* observer_;
|
|
|
| + // Dispatching row count events specific to this password manager table model
|
| + // to this observer.
|
| + PasswordManagerTableModelObserver* row_count_observer_;
|
| +
|
| // Handle to any pending WebDataService::GetLogins query.
|
| WebDataService::Handle pending_login_query_;
|
|
|
| @@ -108,7 +132,8 @@ class MultiLabelButtons : public views::NativeButton {
|
| class PasswordManagerView : public views::View,
|
| public views::DialogDelegate,
|
| public views::TableViewObserver,
|
| - public views::NativeButton::Listener {
|
| + public views::NativeButton::Listener,
|
| + public PasswordManagerTableModelObserver {
|
| public:
|
| explicit PasswordManagerView(Profile* profile);
|
| virtual ~PasswordManagerView();
|
| @@ -121,8 +146,6 @@ 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();
|
|
|
| @@ -139,6 +162,9 @@ class PasswordManagerView : public views::View,
|
| virtual void WindowClosing();
|
| virtual views::View* GetContentsView();
|
|
|
| + // PasswordManagerTableModelObserver implementation.
|
| + virtual void OnRowCountChanged(size_t rows);
|
| +
|
| private:
|
| // Wire up buttons, the model, and the table view, and query the DB for
|
| // saved login data tied to the given profile.
|
| @@ -160,6 +186,8 @@ class PasswordManagerView : public views::View,
|
| views::NativeButton remove_all_button_;
|
| views::Label password_label_;
|
|
|
| + static PasswordManagerView* instance_;
|
| +
|
| DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerView);
|
| };
|
| #endif // CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__
|
|
|