Commit 4cfdb654 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Allow switching between sign-in notification infobar titles.

Use kSigninNotificationInfobarUsernameInTitle experimental flag to allow
switching between "Signed in as [username]" and "Signed in to Chrome"
titles in the sign-in notification infobar.

Bug: 1145592
Change-Id: I31a7b98137f1006f826ff18ee3168d9f87b65431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526420Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825342}
parent f4e6d932
......@@ -33,6 +33,7 @@ source_set("authentication") {
"//components/consent_auditor",
"//components/infobars/core",
"//components/prefs",
"//components/signin/ios/browser",
"//components/signin/public/base",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager/objc",
......
......@@ -5,7 +5,6 @@
#ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_NOTIFICATION_INFOBAR_DELEGATE_H_
#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_NOTIFICATION_INFOBAR_DELEGATE_H_
#import <UIKit/UIKit.h>
#include <memory>
#include "base/macros.h"
......@@ -17,6 +16,7 @@
@protocol ApplicationSettingsCommands;
class ChromeBrowserState;
@class UIViewController;
namespace gfx {
class Image;
......
......@@ -15,6 +15,7 @@
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_delegate.h"
#include "components/infobars/core/infobar_manager.h"
#include "components/signin/ios/browser/features.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/infobars/infobar_utils.h"
#import "ios/chrome/browser/main/browser.h"
......@@ -74,9 +75,17 @@ SigninNotificationInfoBarDelegate::SigninNotificationInfoBarDelegate(
image = [UIImage imageNamed:@"ios_default_avatar"];
}
icon_ = gfx::Image(CircularImageFromImage(image, kAvatarImageDimension));
if (base::FeatureList::IsEnabled(
signin::kSigninNotificationInfobarUsernameInTitle)) {
message_ = base::SysNSStringToUTF16(l10n_util::GetNSStringF(
IDS_IOS_SIGNIN_ACCOUNT_NOTIFICATION_TITLE_WITH_USERNAME,
base::SysNSStringToUTF16(identity.userFullName)));
} else {
message_ = base::SysNSStringToUTF16(
l10n_util::GetNSString(IDS_IOS_SIGNIN_ACCOUNT_NOTIFICATION_TITLE));
}
button_text_ =
base::SysNSStringToUTF16(l10n_util::GetNSString(IDS_IOS_SETTINGS_TITLE));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment