Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h |
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h |
index 39e1e5057f41ebefb11944967069ac5ad51a7511..de18552ef4871324a11a4eadbfea9f9649325c09 100644 |
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h |
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h |
@@ -26,12 +26,66 @@ class LabelButton; |
class GridLayout; |
} |
+// The ManagePasswordsBubbleView controls the contents of the bubble which |
+// pops up when Chrome offers to save a user's password, or when the user |
+// interacts with the Omnibox icon. It has two distinct states: |
+// |
+// 1. PendingView: Offers the user the possibility of saving credentials. |
+// 2. ManageView: Displays the current page's saved credentials. |
+// |
+// TODO(mkwst): Add a third state: "Informing the user that the current page |
+// is blacklisted." |
class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
- public views::BubbleDelegateView, |
- public views::ButtonListener, |
- public views::ComboboxListener, |
- public views::LinkListener { |
+ public views::BubbleDelegateView { |
public: |
+ // A view offering the user the ability to save credentials. Contains a |
+ // single ManagePasswordItemView, along with a "Save Passwords" button |
+ // and a rejection combobox. |
+ class PendingView : public views::View, |
+ public views::ButtonListener, |
+ public views::ComboboxListener { |
+ public: |
+ explicit PendingView(ManagePasswordsBubbleView* parent); |
+ virtual ~PendingView(); |
+ |
+ private: |
+ // views::ButtonListener: |
+ virtual void ButtonPressed(views::Button* sender, |
+ const ui::Event& event) OVERRIDE; |
+ |
+ // Handles the event when the user changes an index of a combobox. |
+ virtual void OnPerformAction(views::Combobox* source) OVERRIDE; |
+ |
+ ManagePasswordsBubbleView* parent_; |
+ |
+ views::BlueButton* save_button_; |
+ views::Combobox* refuse_combobox_; |
+ }; |
+ |
+ // A view offering the user a list of her currently saved credentials |
+ // for the current page, along with a "Manage passwords" link and a |
+ // "Done" button. |
+ class ManageView : public views::View, |
+ public views::ButtonListener, |
+ public views::LinkListener { |
+ public: |
+ explicit ManageView(ManagePasswordsBubbleView* parent); |
+ virtual ~ManageView(); |
+ |
+ private: |
+ // views::ButtonListener: |
+ virtual void ButtonPressed(views::Button* sender, |
+ const ui::Event& event) OVERRIDE; |
+ |
+ // views::LinkListener: |
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
+ |
+ ManagePasswordsBubbleView* parent_; |
+ |
+ views::Link* manage_link_; |
+ views::LabelButton* done_button_; |
+ }; |
+ |
// Shows the bubble. |
static void ShowBubble(content::WebContents* web_contents, |
DisplayReason reason); |
@@ -69,6 +123,10 @@ class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
// to |layout|. |
void BuildColumnSet(views::GridLayout* layout, ColumnSetType type); |
+ // Given a layout, add an appropriate title using a SINGLE_VIEW_COLUMN_SET, |
+ // followed by a spacer row. |
+ void AddTitleRow(views::GridLayout* layout) const; |
+ |
// If the bubble is not anchored to a view, places the bubble in the top |
// right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s |
// browser window. Because the positioning is based on the size of the |
@@ -91,28 +149,11 @@ class ManagePasswordsBubbleView : public ManagePasswordsBubble, |
virtual void Init() OVERRIDE; |
virtual void WindowClosing() OVERRIDE; |
- // views::ButtonListener: |
- virtual void ButtonPressed(views::Button* sender, |
- const ui::Event& event) OVERRIDE; |
- |
- // views::LinkListener: |
- virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
- |
- // Handles the event when the user changes an index of a combobox. |
- virtual void OnPerformAction(views::Combobox* source) OVERRIDE; |
- |
// Singleton instance of the Password bubble. The Password bubble can only be |
// shown on the active browser window, so there is no case in which it will be |
// shown twice at the same time. |
static ManagePasswordsBubbleView* manage_passwords_bubble_; |
- // The buttons that are shown in the bubble. |
- views::BlueButton* save_button_; |
- views::Combobox* refuse_combobox_; |
- |
- views::Link* manage_link_; |
- views::LabelButton* done_button_; |
- |
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView); |
}; |