blob: 821581c8b4b27f70fa43f5f4dd067eef7f4e1ff3 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
#define IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
#include <memory>
#include "base/macros.h"
#include "ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_delegate.h"
namespace password_manager {
class PasswordFormManager;
}
namespace infobars {
class InfoBarManager;
}
// After a successful *new* login attempt, Chrome passes the current
// password_manager::PasswordFormManager and move it to a
// IOSChromeSavePasswordInfoBarDelegate while the user makes up their mind
// with the "save password" infobar.
class IOSChromeSavePasswordInfoBarDelegate
: public IOSChromePasswordManagerInfoBarDelegate {
public:
// Creates the infobar for |form_to_save| and adds it to |infobar_manager|.
// |is_smart_lock_enabled| controls the branding string.
static void Create(
bool is_smart_lock_branding_enabled,
infobars::InfoBarManager* infobar_manager,
std::unique_ptr<password_manager::PasswordFormManager> form_to_save);
~IOSChromeSavePasswordInfoBarDelegate() override;
bool ShouldExpire(const NavigationDetails& details) const override;
private:
IOSChromeSavePasswordInfoBarDelegate(
bool is_smart_lock_branding_enabled,
std::unique_ptr<password_manager::PasswordFormManager> form_to_save);
// ConfirmInfoBarDelegate implementation.
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetMessageText() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
bool Cancel() override;
DISALLOW_COPY_AND_ASSIGN(IOSChromeSavePasswordInfoBarDelegate);
};
#endif // IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE_H_