Commit 8f593833 authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

aura: Remove apps from NTP4 and disable NTP4 intro bubble.

BUG=116318,115952
TEST=Verify above issues.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124722 0039d316-1c4b-4281-b951-d872f2087c98
parent ed13312c
...@@ -153,10 +153,21 @@ cr.define('ntp', function() { ...@@ -153,10 +153,21 @@ cr.define('ntp', function() {
this.shownPage = templateData.shown_page_type; this.shownPage = templateData.shown_page_type;
this.shownPageIndex = templateData.shown_page_index; this.shownPageIndex = templateData.shown_page_index;
// Request data on the apps so we can fill them in. if (templateData.showAppsPage) {
// Note that this is kicked off asynchronously. 'getAppsCallback' will be // Request data on the apps so we can fill them in.
// invoked at some point after this function returns. // Note that this is kicked off asynchronously. 'getAppsCallback' will
chrome.send('getApps'); // be invoked at some point after this function returns.
chrome.send('getApps');
} else {
// No apps page.
if (this.shownPage == templateData['apps_page_id']) {
this.shownPage = templateData['most_visited_page_id'];
this.shownPageIndex = 0;
}
// Mark section ready asynchronously soon after.
window.setTimeout(this.markSectionReady_.bind(this), 0);
}
document.addEventListener('keydown', this.onDocKeyDown_.bind(this)); document.addEventListener('keydown', this.onDocKeyDown_.bind(this));
// Prevent touch events from triggering any sort of native scrolling // Prevent touch events from triggering any sort of native scrolling
...@@ -366,18 +377,25 @@ cr.define('ntp', function() { ...@@ -366,18 +377,25 @@ cr.define('ntp', function() {
this.cardSlider.currentCard = prevCurrentCard; this.cardSlider.currentCard = prevCurrentCard;
// Tell the slider about the pages.
this.updateSliderCards();
if (highlightApp) if (highlightApp)
this.appAdded(highlightApp, true); this.appAdded(highlightApp, true);
logEvent('apps.layout: ' + (Date.now() - startTime));
this.markSectionReady_();
},
/**
* Marks section ready.
* @private
*/
markSectionReady_: function() {
// Tell the slider about the pages.
this.updateSliderCards();
// Mark the current page. // Mark the current page.
this.cardSlider.currentCardValue.navigationDot.classList.add('selected'); this.cardSlider.currentCardValue.navigationDot.classList.add('selected');
logEvent('apps.layout: ' + (Date.now() - startTime));
document.documentElement.classList.remove('starting-up'); document.documentElement.classList.remove('starting-up');
cr.dispatchSimpleEvent(document, 'sectionready', true, true); cr.dispatchSimpleEvent(document, 'sectionready', true, true);
}, },
......
...@@ -168,6 +168,9 @@ void NewTabPageHandler::GetLocalizedValues(Profile* profile, ...@@ -168,6 +168,9 @@ void NewTabPageHandler::GetLocalizedValues(Profile* profile,
values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK);
values->SetInteger("shown_page_index", shown_page & INDEX_MASK); values->SetInteger("shown_page_index", shown_page & INDEX_MASK);
#if !defined(USE_AURA)
// Only show intro bubble for non-aura build.
PrefService* local_state = g_browser_process->local_state(); PrefService* local_state = g_browser_process->local_state();
int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount);
// This preference used to exist in profile, so check the profile if it has // This preference used to exist in profile, so check the profile if it has
...@@ -186,6 +189,7 @@ void NewTabPageHandler::GetLocalizedValues(Profile* profile, ...@@ -186,6 +189,7 @@ void NewTabPageHandler::GetLocalizedValues(Profile* profile,
values->SetString("learn_more", values->SetString("learn_more",
l10n_util::GetStringUTF16(IDS_LEARN_MORE)); l10n_util::GetStringUTF16(IDS_LEARN_MORE));
} }
#endif
} }
// static // static
......
...@@ -122,11 +122,14 @@ NewTabUI::NewTabUI(content::WebUI* web_ui) ...@@ -122,11 +122,14 @@ NewTabUI::NewTabUI(content::WebUI* web_ui)
if (GetProfile()->IsSyncAccessible()) if (GetProfile()->IsSyncAccessible())
web_ui->AddMessageHandler(new NewTabPageSyncHandler()); web_ui->AddMessageHandler(new NewTabPageSyncHandler());
#endif #endif
ExtensionService* service = GetProfile()->GetExtensionService();
// We might not have an ExtensionService (on ChromeOS when not logged in if (ShouldShowAppsPage()) {
// for example). ExtensionService* service = GetProfile()->GetExtensionService();
if (service) // We might not have an ExtensionService (on ChromeOS when not logged in
web_ui->AddMessageHandler(new AppLauncherHandler(service)); // for example).
if (service)
web_ui->AddMessageHandler(new AppLauncherHandler(service));
}
web_ui->AddMessageHandler(new NewTabPageHandler()); web_ui->AddMessageHandler(new NewTabPageHandler());
web_ui->AddMessageHandler(new FaviconWebUIHandler()); web_ui->AddMessageHandler(new FaviconWebUIHandler());
...@@ -287,6 +290,16 @@ bool NewTabUI::ShouldShowAppInstallHint() { ...@@ -287,6 +290,16 @@ bool NewTabUI::ShouldShowAppInstallHint() {
WebStoreLinkExperimentGroupIs(g_hint_group); WebStoreLinkExperimentGroupIs(g_hint_group);
} }
// static
bool NewTabUI::ShouldShowAppsPage() {
#if defined(USE_AURA)
// Ash shows apps in app list thus should not show apps page in NTP4.
return false;
#else
return true;
#endif
}
// static // static
bool NewTabUI::IsSuggestionsPageEnabled() { bool NewTabUI::IsSuggestionsPageEnabled() {
return CommandLine::ForCurrentProcess()->HasSwitch( return CommandLine::ForCurrentProcess()->HasSwitch(
......
...@@ -42,6 +42,9 @@ class NewTabUI : public content::WebUIController, ...@@ -42,6 +42,9 @@ class NewTabUI : public content::WebUIController,
// Returns whether or not to show the app install hint. // Returns whether or not to show the app install hint.
static bool ShouldShowAppInstallHint(); static bool ShouldShowAppInstallHint();
// Returns whether or not to show the apps page.
static bool ShouldShowAppsPage();
// Returns whether or not the "suggestions links page" is enabled. // Returns whether or not the "suggestions links page" is enabled.
static bool IsSuggestionsPageEnabled(); static bool IsSuggestionsPageEnabled();
......
...@@ -348,6 +348,7 @@ void NTPResourceCache::CreateNewTabHTML() { ...@@ -348,6 +348,7 @@ void NTPResourceCache::CreateNewTabHTML() {
NewTabUI::ShouldShowAppInstallHint()); NewTabUI::ShouldShowAppInstallHint());
localized_strings.SetBoolean("isSuggestionsPageEnabled", localized_strings.SetBoolean("isSuggestionsPageEnabled",
NewTabUI::IsSuggestionsPageEnabled()); NewTabUI::IsSuggestionsPageEnabled());
localized_strings.SetBoolean("showAppsPage", NewTabUI::ShouldShowAppsPage());
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
localized_strings.SetString("expandMenu", localized_strings.SetString("expandMenu",
......
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