#ifndef CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer/elapsed_timer.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar_delegate.h"
#include "components/password_manager/core/browser/password_form_manager.h"
namespace content {
class WebContents;
}
class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
static void Create(content::WebContents* web_contents,
PasswordFormManager* form_to_save,
const std::string& uma_histogram_suffix);
virtual ~SavePasswordInfoBarDelegate();
void SetUseAdditionalPasswordAuthentication(
bool use_additional_authentication);
private:
enum ResponseType {
NO_RESPONSE = 0,
REMEMBER_PASSWORD,
NEVER_REMEMBER_PASSWORD,
INFOBAR_DISMISSED,
NUM_RESPONSE_TYPES,
};
SavePasswordInfoBarDelegate(PasswordFormManager* form_to_save,
const std::string& uma_histogram_suffix);
static scoped_ptr<InfoBar> CreateInfoBar(
scoped_ptr<SavePasswordInfoBarDelegate> delegate);
virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE;
virtual int GetIconID() const OVERRIDE;
virtual Type GetInfoBarType() const OVERRIDE;
virtual base::string16 GetMessageText() const OVERRIDE;
virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
scoped_ptr<PasswordFormManager> form_to_save_;
ResponseType infobar_response_;
base::ElapsedTimer timer_;
const std::string uma_histogram_suffix_;
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate);
};
#endif