Commit 684f902f authored by srvasude@chromium.org's avatar srvasude@chromium.org

The isSuggestionsPageEnabled flag will be deprecated/be reassigned to...

The isSuggestionsPageEnabled flag will be deprecated/be reassigned to suggestions coming from user history.

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10827075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150512 0039d316-1c4b-4281-b951-d872f2087c98
parent 9374c7e6
...@@ -108,7 +108,7 @@ cr.define('ntp', function() { ...@@ -108,7 +108,7 @@ cr.define('ntp', function() {
*/ */
function onLoad() { function onLoad() {
sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1; sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1;
if (loadTimeData.getBoolean('isSuggestionsPageEnabled')) if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled'))
sectionsToWaitFor++; sectionsToWaitFor++;
measureNavDots(); measureNavDots();
...@@ -140,7 +140,7 @@ cr.define('ntp', function() { ...@@ -140,7 +140,7 @@ cr.define('ntp', function() {
false); false);
chrome.send('getMostVisited'); chrome.send('getMostVisited');
if (loadTimeData.getBoolean('isSuggestionsPageEnabled')) { if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) {
var suggestions_script = document.createElement('script'); var suggestions_script = document.createElement('script');
suggestions_script.src = 'suggestions_page.js'; suggestions_script.src = 'suggestions_page.js';
suggestions_script.onload = function() { suggestions_script.onload = function() {
......
...@@ -107,7 +107,7 @@ NewTabUI::NewTabUI(content::WebUI* web_ui) ...@@ -107,7 +107,7 @@ NewTabUI::NewTabUI(content::WebUI* web_ui)
web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); web_ui->AddMessageHandler(new RecentlyClosedTabsHandler());
web_ui->AddMessageHandler(new MetricsHandler()); web_ui->AddMessageHandler(new MetricsHandler());
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
if (NewTabUI::IsSuggestionsPageEnabled()) if (NewTabUI::IsDiscoveryInNTPEnabled())
web_ui->AddMessageHandler(new SuggestionsHandler()); web_ui->AddMessageHandler(new SuggestionsHandler());
// Android doesn't have a sync promo/username on NTP. // Android doesn't have a sync promo/username on NTP.
if (GetProfile()->IsSyncAccessible()) if (GetProfile()->IsSyncAccessible())
...@@ -141,8 +141,8 @@ NewTabUI::NewTabUI(content::WebUI* web_ui) ...@@ -141,8 +141,8 @@ NewTabUI::NewTabUI(content::WebUI* web_ui)
new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); new NewTabHTMLSource(GetProfile()->GetOriginalProfile());
// These two resources should be loaded only if suggestions NTP is enabled. // These two resources should be loaded only if suggestions NTP is enabled.
html_source->AddResource("suggestions_page.css", "text/css", html_source->AddResource("suggestions_page.css", "text/css",
NewTabUI::IsSuggestionsPageEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0); NewTabUI::IsDiscoveryInNTPEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0);
if (NewTabUI::IsSuggestionsPageEnabled()) { if (NewTabUI::IsDiscoveryInNTPEnabled()) {
html_source->AddResource("suggestions_page.js", "application/javascript", html_source->AddResource("suggestions_page.js", "application/javascript",
IDR_SUGGESTIONS_PAGE_JS); IDR_SUGGESTIONS_PAGE_JS);
} }
...@@ -269,7 +269,7 @@ void NewTabUI::RegisterUserPrefs(PrefService* prefs) { ...@@ -269,7 +269,7 @@ void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
NewTabPageHandler::RegisterUserPrefs(prefs); NewTabPageHandler::RegisterUserPrefs(prefs);
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
AppLauncherHandler::RegisterUserPrefs(prefs); AppLauncherHandler::RegisterUserPrefs(prefs);
if (NewTabUI::IsSuggestionsPageEnabled()) if (NewTabUI::IsDiscoveryInNTPEnabled())
SuggestionsHandler::RegisterUserPrefs(prefs); SuggestionsHandler::RegisterUserPrefs(prefs);
#endif #endif
MostVisitedHandler::RegisterUserPrefs(prefs); MostVisitedHandler::RegisterUserPrefs(prefs);
...@@ -288,9 +288,9 @@ bool NewTabUI::ShouldShowApps() { ...@@ -288,9 +288,9 @@ bool NewTabUI::ShouldShowApps() {
} }
// static // static
bool NewTabUI::IsSuggestionsPageEnabled() { bool NewTabUI::IsDiscoveryInNTPEnabled() {
return CommandLine::ForCurrentProcess()->HasSwitch( return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSuggestionsTabPage); switches::kEnableDiscoveryInNewTabPage);
} }
// static // static
......
...@@ -34,8 +34,8 @@ class NewTabUI : public content::WebUIController, ...@@ -34,8 +34,8 @@ class NewTabUI : public content::WebUIController,
// Returns whether or not to show apps pages. // Returns whether or not to show apps pages.
static bool ShouldShowApps(); static bool ShouldShowApps();
// Returns whether or not the "suggestions links page" is enabled. // Returns whether or not "Discovery" in the NTP is Enabled.
static bool IsSuggestionsPageEnabled(); static bool IsDiscoveryInNTPEnabled();
// Adds "url", "title", and "direction" keys on incoming dictionary, setting // Adds "url", "title", and "direction" keys on incoming dictionary, setting
// title as the url as a fallback on empty title. // title as the url as a fallback on empty title.
......
...@@ -371,8 +371,8 @@ void NTPResourceCache::CreateNewTabHTML() { ...@@ -371,8 +371,8 @@ void NTPResourceCache::CreateNewTabHTML() {
GetUrlWithLang(GURL(extension_urls::GetWebstoreLaunchURL()))); GetUrlWithLang(GURL(extension_urls::GetWebstoreLaunchURL())));
load_time_data.SetString("appInstallHintText", load_time_data.SetString("appInstallHintText",
l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL));
load_time_data.SetBoolean("isSuggestionsPageEnabled", load_time_data.SetBoolean("isDiscoveryInNTPEnabled",
NewTabUI::IsSuggestionsPageEnabled()); NewTabUI::IsDiscoveryInNTPEnabled());
load_time_data.SetBoolean("showApps", NewTabUI::ShouldShowApps()); load_time_data.SetBoolean("showApps", NewTabUI::ShouldShowApps());
load_time_data.SetString("collapseSessionMenuItemText", load_time_data.SetString("collapseSessionMenuItemText",
l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION)); l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION));
......
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