#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
#include "base/basictypes.h"
#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/combobox/combobox_listener.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/link_listener.h"
class ManagePasswordsIconView;
namespace content {
class WebContents;
}
namespace views {
class BlueButton;
class LabelButton;
class GridLayout;
}
class ManagePasswordsBubbleView : public views::BubbleDelegateView,
public views::ButtonListener,
public views::ComboboxListener,
public views::LinkListener {
public:
enum FieldType { USERNAME_FIELD, PASSWORD_FIELD };
enum BubbleDisplayReason { AUTOMATIC = 0, USER_ACTION, NUM_DISPLAY_REASONS };
enum BubbleDismissalReason {
BUBBLE_LOST_FOCUS = 0,
CLICKED_SAVE,
CLICKED_NOPE,
CLICKED_NEVER,
CLICKED_MANAGE,
CLICKED_DONE,
NUM_DISMISSAL_REASONS,
NOT_DISPLAYED
};
static void ShowBubble(content::WebContents* web_contents,
ManagePasswordsIconView* icon_view,
BubbleDisplayReason reason);
static void CloseBubble(BubbleDismissalReason reason);
static bool IsShowing();
private:
enum ColumnSetType {
SINGLE_VIEW_COLUMN_SET = 0,
DOUBLE_VIEW_COLUMN_SET = 1,
};
ManagePasswordsBubbleView(content::WebContents* web_contents,
views::View* anchor_view,
ManagePasswordsIconView* icon_view,
BubbleDisplayReason reason);
virtual ~ManagePasswordsBubbleView();
void BuildColumnSet(views::GridLayout* layout, ColumnSetType type);
int GetMaximumFieldWidth(FieldType type);
void AdjustForFullscreen(const gfx::Rect& screen_bounds);
void Close(BubbleDismissalReason reason);
virtual void Init() OVERRIDE;
virtual void WindowClosing() OVERRIDE;
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
virtual void OnPerformAction(views::Combobox* source) OVERRIDE;
static ManagePasswordsBubbleView* manage_passwords_bubble_;
ManagePasswordsBubbleModel* manage_passwords_bubble_model_;
ManagePasswordsIconView* icon_view_;
views::BlueButton* save_button_;
views::Combobox* refuse_combobox_;
views::Link* manage_link_;
views::LabelButton* done_button_;
BubbleDismissalReason dismissal_reason_;
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
};
#endif