Skip to content
Snippets Groups Projects
Commit e5b5f958 authored by aa@chromium.org's avatar aa@chromium.org
Browse files

Enable default apps by default.

Also, always show the apps section. We were only hiding it when
there was zero elements when we were in our transitionary
phase. To make this look less weird when there are actually
zero elements, add the webstore element to the miniview and
closed menus.

BUG=64737
TEST=In a fresh profile, go to chrome://extensions/ -> developer mode,
and click 'update now'. Go to NTP. Should see default apps. Remove
all default apps. Apps section should remain. Collapse apps section
by clicking heading. Should see webstore item in minimized view. Hide
apps section by clicking 'x'. Should see webstore item in closed
section menu on bottom of page.

Review URL: http://codereview.chromium.org/5804005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69180 0039d316-1c4b-4281-b951-d872f2087c98
parent c40151ab
No related branches found
No related tags found
No related merge requests found
...@@ -181,10 +181,6 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { ...@@ -181,10 +181,6 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
} }
dictionary->Set("apps", list); dictionary->Set("apps", list);
bool showLauncher =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppLauncher);
dictionary->SetBoolean("showLauncher", showLauncher);
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// App windows are not yet implemented on mac. // App windows are not yet implemented on mac.
dictionary->SetBoolean("disableAppWindowLaunch", true); dictionary->SetBoolean("disableAppWindowLaunch", true);
......
...@@ -406,14 +406,6 @@ void ProfileImpl::RegisterComponentExtensions() { ...@@ -406,14 +406,6 @@ void ProfileImpl::RegisterComponentExtensions() {
} }
void ProfileImpl::InstallDefaultApps() { void ProfileImpl::InstallDefaultApps() {
#if !defined(OS_CHROMEOS)
// On desktop Chrome, we don't have default apps on by, err, default yet.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableDefaultApps)) {
return;
}
#endif
// The web store only supports en-US at the moment, so we don't install // The web store only supports en-US at the moment, so we don't install
// default apps in other locales. // default apps in other locales.
if (g_browser_process->GetApplicationLocale() != "en-US") if (g_browser_process->GetApplicationLocale() != "en-US")
......
...@@ -25,7 +25,7 @@ function getAppsCallback(data) { ...@@ -25,7 +25,7 @@ function getAppsCallback(data) {
var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
var appsPromo = $('apps-promo'); var appsPromo = $('apps-promo');
var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + apps.showPromo; var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + apps.showPromo;
var webStoreEntry; var webStoreEntry, webStoreMiniEntry;
// Hide menu options that are not supported on the OS or windowing system. // Hide menu options that are not supported on the OS or windowing system.
...@@ -45,26 +45,28 @@ function getAppsCallback(data) { ...@@ -45,26 +45,28 @@ function getAppsCallback(data) {
}); });
clearClosedMenu(apps.menu); clearClosedMenu(apps.menu);
if (data.apps.length == 0 && !data.showLauncher) { data.apps.forEach(function(app) {
appsSection.classList.add('disabled'); appsSectionContent.appendChild(apps.createElement(app));
layoutSections(); });
} else {
data.apps.forEach(function(app) {
appsSectionContent.appendChild(apps.createElement(app));
});
webStoreEntry = apps.createWebStoreElement(); webStoreEntry = apps.createWebStoreElement();
webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing); webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
appsSectionContent.appendChild(webStoreEntry); appsSectionContent.appendChild(webStoreEntry);
data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
appsMiniview.appendChild(apps.createMiniviewElement(app)); appsMiniview.appendChild(apps.createMiniviewElement(app));
addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app)); addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app));
}); });
if (data.apps.length < MAX_MINIVIEW_ITEMS) {
webStoreMiniEntry = apps.createWebStoreMiniElement();
webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
appsMiniview.appendChild(webStoreMiniEntry);
addClosedMenuEntryWithLink(apps.menu,
apps.createWebStoreClosedMenuElement());
}
if (!(shownSections & MINIMIZED_APPS)) { if (!(shownSections & MINIMIZED_APPS)) {
appsSection.classList.remove('disabled'); appsSection.classList.remove('disabled');
}
} }
addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS); addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS);
...@@ -338,6 +340,21 @@ var apps = (function() { ...@@ -338,6 +340,21 @@ var apps = (function() {
}); });
elm.setAttribute('app-id', 'web-store-entry'); elm.setAttribute('app-id', 'web-store-entry');
return elm; return elm;
},
createWebStoreMiniElement: function() {
var span = document.createElement('span');
span.appendChild(this.createWebStoreClosedMenuElement());
return span;
},
createWebStoreClosedMenuElement: function() {
var a = document.createElement('a');
a.textContent = localStrings.getString('web_store_title');
a.href = localStrings.getString('web_store_url');
a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16');
a.className = 'item';
return a;
} }
}; };
})(); })();
...@@ -396,9 +396,6 @@ const char kEnableAccessibility[] = "enable-accessibility"; ...@@ -396,9 +396,6 @@ const char kEnableAccessibility[] = "enable-accessibility";
// Enables AeroPeek for each tab. (This switch only works on Windows 7). // Enables AeroPeek for each tab. (This switch only works on Windows 7).
const char kEnableAeroPeekTabs[] = "enable-aero-peek-tabs"; const char kEnableAeroPeekTabs[] = "enable-aero-peek-tabs";
// Enables the application section of the new tab page.
const char kEnableAppLauncher[] = "enable-app-launcher";
// Enable the inclusion of non-standard ports when generating the Kerberos SPN // Enable the inclusion of non-standard ports when generating the Kerberos SPN
// in response to a Negotiate challenge. See HttpAuthHandlerNegotiate::CreateSPN // in response to a Negotiate challenge. See HttpAuthHandlerNegotiate::CreateSPN
// for more background. // for more background.
...@@ -452,10 +449,6 @@ const char kEnableContentPrefetch[] = "enable-content-prefetch"; ...@@ -452,10 +449,6 @@ const char kEnableContentPrefetch[] = "enable-content-prefetch";
// Enables web developers to create apps for Chrome without using crx packages. // Enables web developers to create apps for Chrome without using crx packages.
const char kEnableCrxlessWebApps[] = "enable-crxless-web-apps"; const char kEnableCrxlessWebApps[] = "enable-crxless-web-apps";
// Whether default apps should be installed in this profile. This flag has no
// effect on Chrome OS because default apps are always enabled there.
const char kEnableDefaultApps[] = "enable-default-apps";
// Enables device motion events. // Enables device motion events.
const char kEnableDeviceMotion[] = "enable-device-motion"; const char kEnableDeviceMotion[] = "enable-device-motion";
......
...@@ -121,7 +121,6 @@ extern const char kEnableAccelerated2dCanvas[]; ...@@ -121,7 +121,6 @@ extern const char kEnableAccelerated2dCanvas[];
extern const char kEnableAcceleratedLayers[]; extern const char kEnableAcceleratedLayers[];
extern const char kEnableAccessibility[]; extern const char kEnableAccessibility[];
extern const char kEnableAeroPeekTabs[]; extern const char kEnableAeroPeekTabs[];
extern const char kEnableAppLauncher[];
extern const char kEnableAuthNegotiatePort[]; extern const char kEnableAuthNegotiatePort[];
extern const char kEnableBackgroundMode[]; extern const char kEnableBackgroundMode[];
extern const char kEnableBenchmarking[]; extern const char kEnableBenchmarking[];
...@@ -135,7 +134,6 @@ extern const char kEnableConfirmToQuit[]; ...@@ -135,7 +134,6 @@ extern const char kEnableConfirmToQuit[];
extern const char kEnableConnectBackupJobs[]; extern const char kEnableConnectBackupJobs[];
extern const char kEnableContentPrefetch[]; extern const char kEnableContentPrefetch[];
extern const char kEnableCrxlessWebApps[]; extern const char kEnableCrxlessWebApps[];
extern const char kEnableDefaultApps[];
extern const char kEnableDeviceMotion[]; extern const char kEnableDeviceMotion[];
extern const char kEnableDNSCertProvenanceChecking[]; extern const char kEnableDNSCertProvenanceChecking[];
extern const char kEnableDNSSECCerts[]; extern const char kEnableDNSSECCerts[];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment