Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm

Issue 2108593002: Create superclass for IOSChromeSavePasswordInfobarDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review rd 2 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm
diff --git a/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm b/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm
index af12ac095382b7677c7dcb08f353ceeb482821a1..98324e8615ca3deb4a117472572c90d54327481a 100644
--- a/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm
+++ b/ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.mm
@@ -6,24 +6,16 @@
#include <utility>
-#include "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/string16.h"
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_manager.h"
#include "components/password_manager/core/browser/password_form_manager.h"
#include "components/password_manager/core/browser/password_manager_constants.h"
#include "components/strings/grit/components_strings.h"
-#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
-#import "ios/chrome/browser/ui/commands/open_url_command.h"
#include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_google_chrome_strings.h"
#include "ios/chrome/grit/ios_strings.h"
-#include "ios/chrome/grit/ios_theme_resources.h"
-#include "ios/web/public/referrer.h"
#include "ui/base/l10n/l10n_util.h"
-#include "url/gurl.h"
using password_manager::PasswordFormManager;
@@ -39,21 +31,13 @@ void IOSChromeSavePasswordInfoBarDelegate::Create(
infobar_manager->CreateConfirmInfoBar(std::move(delegate)));
}
-IOSChromeSavePasswordInfoBarDelegate::~IOSChromeSavePasswordInfoBarDelegate() {
- password_manager::metrics_util::LogUIDismissalReason(infobar_response_);
-}
+IOSChromeSavePasswordInfoBarDelegate::~IOSChromeSavePasswordInfoBarDelegate() {}
IOSChromeSavePasswordInfoBarDelegate::IOSChromeSavePasswordInfoBarDelegate(
bool is_smart_lock_branding_enabled,
std::unique_ptr<PasswordFormManager> form_to_save)
- : form_to_save_(std::move(form_to_save)),
- infobar_response_(password_manager::metrics_util::NO_DIRECT_INTERACTION),
- is_smart_lock_branding_enabled_(is_smart_lock_branding_enabled) {}
-
-infobars::InfoBarDelegate::Type
-IOSChromeSavePasswordInfoBarDelegate::GetInfoBarType() const {
- return PAGE_ACTION_TYPE;
-}
+ : IOSChromePasswordManagerInfoBarDelegate(is_smart_lock_branding_enabled,
+ std::move(form_to_save)) {}
infobars::InfoBarDelegate::InfoBarIdentifier
IOSChromeSavePasswordInfoBarDelegate::GetIdentifier() const {
@@ -61,7 +45,7 @@ IOSChromeSavePasswordInfoBarDelegate::GetIdentifier() const {
}
base::string16 IOSChromeSavePasswordInfoBarDelegate::GetMessageText() const {
- if (is_smart_lock_branding_enabled_) {
+ if (is_smart_lock_branding_enabled()) {
return l10n_util::GetStringUTF16(
IDS_IOS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT_SMART_LOCK_BRANDING);
}
@@ -69,12 +53,6 @@ base::string16 IOSChromeSavePasswordInfoBarDelegate::GetMessageText() const {
IDS_IOS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT);
}
-base::string16 IOSChromeSavePasswordInfoBarDelegate::GetLinkText() const {
- return is_smart_lock_branding_enabled_
- ? l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK)
- : base::string16();
-}
-
base::string16 IOSChromeSavePasswordInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16(
@@ -83,33 +61,15 @@ base::string16 IOSChromeSavePasswordInfoBarDelegate::GetButtonLabel(
}
bool IOSChromeSavePasswordInfoBarDelegate::Accept() {
- DCHECK(form_to_save_);
- form_to_save_->Save();
- infobar_response_ = password_manager::metrics_util::CLICKED_SAVE;
+ DCHECK(form_to_save());
+ form_to_save()->Save();
+ set_infobar_response(password_manager::metrics_util::CLICKED_SAVE);
return true;
}
bool IOSChromeSavePasswordInfoBarDelegate::Cancel() {
- DCHECK(form_to_save_);
- form_to_save_->PermanentlyBlacklist();
- infobar_response_ = password_manager::metrics_util::CLICKED_NEVER;
+ DCHECK(form_to_save());
+ form_to_save()->PermanentlyBlacklist();
+ set_infobar_response(password_manager::metrics_util::CLICKED_NEVER);
return true;
}
-
-bool IOSChromeSavePasswordInfoBarDelegate::LinkClicked(
- WindowOpenDisposition disposition) {
- base::scoped_nsobject<OpenUrlCommand> command([[OpenUrlCommand alloc]
- initWithURL:GURL(password_manager::kPasswordManagerHelpCenterSmartLock)
- referrer:web::Referrer()
- windowName:nil
- inIncognito:NO
- inBackground:NO
- appendTo:kCurrentTab]);
- UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
- [mainWindow chromeExecuteCommand:command];
- return true;
-}
-
-int IOSChromeSavePasswordInfoBarDelegate::GetIconId() const {
- return IDR_IOS_INFOBAR_SAVE_PASSWORD;
-}
« no previous file with comments | « ios/chrome/browser/passwords/ios_chrome_save_password_infobar_delegate.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698