Commit 85a39162 authored by adamta's avatar adamta Committed by Commit Bot

[iOS] Change Discover feed header title for non Google DSE users

For users who don't have Google as their default search engine, change
Discover feed header to "Discover by Google".

Bug: 1085419
Change-Id: I3fde4099d7694ef80853d8b0e1c93ea0aac129ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343844Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Adam Trudeau-Arcaro <adamta@google.com>
Cr-Commit-Position: refs/heads/master@{#798744}
parent c28f2fd4
......@@ -717,6 +717,9 @@ Because your account is managed by <ph name="HOSTED_DOMAIN">$1<ex>google.com</ex
<message name="IDS_IOS_DISCOVER_FEED_TITLE" desc="The title in the Discover feed menu.">
Discover
</message>
<message name="IDS_IOS_DISCOVER_FEED_TITLE_NON_DSE" desc="Title in the feed header when the feed is turned on and the default search engine is not Google. Please use the branded term for Discover, as listed under Product Names in the Google Glossary Manager (TC ID 1799975766543019278).">
Discover by Google
</message>
<message name="IDS_IOS_DISCOVER_FEED_TITLE_OFF_LABEL" desc="The 'Off' label appended to the title in the Discover feed menu.">
Off
</message>
......
a1ea92022fb633c3d590af3aa41d857f466e8186
\ No newline at end of file
......@@ -42,6 +42,7 @@ source_set("content_suggestions") {
"//components/prefs/ios",
"//components/reading_list/core",
"//components/reading_list/ios:ios",
"//components/search_engines:search_engines",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager/objc",
"//components/strings",
......
......@@ -14,6 +14,8 @@
#include "components/ntp_snippets/remote/remote_suggestions_scheduler.h"
#include "components/ntp_tiles/most_visited_sites.h"
#include "components/prefs/pref_service.h"
#import "components/search_engines/template_url.h"
#import "components/search_engines/template_url_service.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/discover_feed/discover_feed_service_factory.h"
#include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h"
......@@ -26,7 +28,7 @@
#include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h"
#include "ios/chrome/browser/pref_names.h"
#include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
#import "ios/chrome/browser/search_engines/template_url_service_factory.h"
#import "ios/chrome/browser/signin/authentication_service.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
......@@ -158,11 +160,13 @@
self.authService = AuthenticationServiceFactory::GetForBrowserState(
self.browser->GetBrowserState());
TemplateURLService* templateURLService =
ios::TemplateURLServiceFactory::GetForBrowserState(
self.browser->GetBrowserState());
self.NTPMediator = [[NTPHomeMediator alloc]
initWithWebState:self.webState
templateURLService:ios::TemplateURLServiceFactory::
GetForBrowserState(
self.browser->GetBrowserState())
templateURLService:templateURLService
URLLoader:UrlLoadingBrowserAgent::FromBrowser(self.browser)
authService:self.authService
identityManager:IdentityManagerFactory::GetForBrowserState(
......@@ -205,14 +209,19 @@
}
self.discoverFeedViewController = [self discoverFeed];
BOOL isGoogleDefaultSearchProvider =
templateURLService->GetDefaultSearchProvider()->GetEngineType(
templateURLService->search_terms_data()) == SEARCH_ENGINE_GOOGLE;
self.contentSuggestionsMediator = [[ContentSuggestionsMediator alloc]
initWithContentService:contentSuggestionsService
largeIconService:largeIconService
largeIconCache:cache
mostVisitedSite:std::move(mostVisitedFactory)
readingListModel:readingListModel
prefService:prefs
discoverFeed:self.discoverFeedViewController];
initWithContentService:contentSuggestionsService
largeIconService:largeIconService
largeIconCache:cache
mostVisitedSite:std::move(mostVisitedFactory)
readingListModel:readingListModel
prefService:prefs
discoverFeed:self.discoverFeedViewController
isGoogleDefaultSearchProvider:isGoogleDefaultSearchProvider];
self.contentSuggestionsMediator.commandHandler = self.NTPMediator;
self.contentSuggestionsMediator.headerProvider = self.headerController;
self.contentSuggestionsMediator.contentArticlesExpanded =
......
......@@ -47,15 +47,16 @@ class ReadingListModel;
// Initialize the mediator with the |contentService| to mediate.
- (instancetype)
initWithContentService:
(ntp_snippets::ContentSuggestionsService*)contentService
largeIconService:(favicon::LargeIconService*)largeIconService
largeIconCache:(LargeIconCache*)largeIconCache
mostVisitedSite:
(std::unique_ptr<ntp_tiles::MostVisitedSites>)mostVisitedSites
readingListModel:(ReadingListModel*)readingListModel
prefService:(PrefService*)prefService
discoverFeed:(UIViewController*)discoverFeed
initWithContentService:
(ntp_snippets::ContentSuggestionsService*)contentService
largeIconService:(favicon::LargeIconService*)largeIconService
largeIconCache:(LargeIconCache*)largeIconCache
mostVisitedSite:(std::unique_ptr<ntp_tiles::MostVisitedSites>)
mostVisitedSites
readingListModel:(ReadingListModel*)readingListModel
prefService:(PrefService*)prefService
discoverFeed:(UIViewController*)discoverFeed
isGoogleDefaultSearchProvider:(BOOL)isGoogleDefaultSearchProvider
NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
......
......@@ -145,15 +145,16 @@ const NSInteger kMaxNumMostVisitedTiles = 4;
#pragma mark - Public
- (instancetype)
initWithContentService:
(ntp_snippets::ContentSuggestionsService*)contentService
largeIconService:(favicon::LargeIconService*)largeIconService
largeIconCache:(LargeIconCache*)largeIconCache
mostVisitedSite:
(std::unique_ptr<ntp_tiles::MostVisitedSites>)mostVisitedSites
readingListModel:(ReadingListModel*)readingListModel
prefService:(PrefService*)prefService
discoverFeed:(UIViewController*)discoverFeed {
initWithContentService:
(ntp_snippets::ContentSuggestionsService*)contentService
largeIconService:(favicon::LargeIconService*)largeIconService
largeIconCache:(LargeIconCache*)largeIconCache
mostVisitedSite:(std::unique_ptr<ntp_tiles::MostVisitedSites>)
mostVisitedSites
readingListModel:(ReadingListModel*)readingListModel
prefService:(PrefService*)prefService
discoverFeed:(UIViewController*)discoverFeed
isGoogleDefaultSearchProvider:(BOOL)isGoogleDefaultSearchProvider {
self = [super init];
if (self) {
_contentSuggestionsEnabled =
......@@ -176,7 +177,8 @@ const NSInteger kMaxNumMostVisitedTiles = 4;
_learnMoreItem = [[ContentSuggestionsLearnMoreItem alloc] init];
_discoverFeed = discoverFeed;
_discoverSectionInfo = DiscoverSectionInformation();
_discoverSectionInfo =
DiscoverSectionInformation(isGoogleDefaultSearchProvider);
_discoverItem = [[ContentSuggestionsDiscoverItem alloc] init];
_discoverItem.discoverFeed = _discoverFeed;
......
......@@ -61,7 +61,8 @@ ContentSuggestionsSectionInformation* MostVisitedSectionInformation();
ContentSuggestionsSectionInformation* LearnMoreSectionInformation();
// Creates and returns a SectionInfo for the Discover feed section.
ContentSuggestionsSectionInformation* DiscoverSectionInformation();
ContentSuggestionsSectionInformation* DiscoverSectionInformation(
BOOL isGoogleDefaultSearchProvider);
// Converts a ntp_tiles::NTPTile |tile| to a ContentSuggestionsMostVisitedItem
// with a |sectionInfo|.
......
......@@ -132,14 +132,18 @@ ContentSuggestionsSectionInformation* LearnMoreSectionInformation() {
return EmptySectionInfo(ContentSuggestionsSectionLearnMore);
}
ContentSuggestionsSectionInformation* DiscoverSectionInformation() {
ContentSuggestionsSectionInformation* DiscoverSectionInformation(
BOOL isGoogleDefaultSearchProvider) {
ContentSuggestionsSectionInformation* sectionInfo =
[[ContentSuggestionsSectionInformation alloc]
initWithSectionID:ContentSuggestionsSectionDiscover];
sectionInfo.title = l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE);
sectionInfo.footerTitle = nil;
sectionInfo.showIfEmpty = YES;
sectionInfo.layout = ContentSuggestionsSectionLayoutCustom;
sectionInfo.title =
isGoogleDefaultSearchProvider
? l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE)
: l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE_NON_DSE);
return sectionInfo;
}
......
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