summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 21:12:10 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 21:12:10 +0000
commite5b5f958a41d75c9e183fd122eb530d747e29e4a (patch)
treeca68e6ee47d07a86ab51d1ee4cd5c0590360d87d
parentc40151ab07cfb8fc7893c295726a5ad176d10ff3 (diff)
downloadchromium_src-e5b5f958a41d75c9e183fd122eb530d747e29e4a.zip
chromium_src-e5b5f958a41d75c9e183fd122eb530d747e29e4a.tar.gz
chromium_src-e5b5f958a41d75c9e183fd122eb530d747e29e4a.tar.bz2
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
-rw-r--r--chrome/browser/dom_ui/app_launcher_handler.cc4
-rw-r--r--chrome/browser/profiles/profile_impl.cc8
-rw-r--r--chrome/browser/resources/ntp/apps.js53
-rw-r--r--chrome/common/chrome_switches.cc7
-rw-r--r--chrome/common/chrome_switches.h2
5 files changed, 35 insertions, 39 deletions
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index a6f35fb..01bffa9 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -181,10 +181,6 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
}
dictionary->Set("apps", list);
- bool showLauncher =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppLauncher);
- dictionary->SetBoolean("showLauncher", showLauncher);
-
#if defined(OS_MACOSX)
// App windows are not yet implemented on mac.
dictionary->SetBoolean("disableAppWindowLaunch", true);
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 3312a7e..436727b 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -406,14 +406,6 @@ void ProfileImpl::RegisterComponentExtensions() {
}
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
// default apps in other locales.
if (g_browser_process->GetApplicationLocale() != "en-US")
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js
index 41a5ebf..2be85fa 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -25,7 +25,7 @@ function getAppsCallback(data) {
var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
var appsPromo = $('apps-promo');
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.
@@ -45,26 +45,28 @@ function getAppsCallback(data) {
});
clearClosedMenu(apps.menu);
- if (data.apps.length == 0 && !data.showLauncher) {
- appsSection.classList.add('disabled');
- layoutSections();
- } else {
- data.apps.forEach(function(app) {
- appsSectionContent.appendChild(apps.createElement(app));
- });
+ data.apps.forEach(function(app) {
+ appsSectionContent.appendChild(apps.createElement(app));
+ });
- webStoreEntry = apps.createWebStoreElement();
- webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
- appsSectionContent.appendChild(webStoreEntry);
+ webStoreEntry = apps.createWebStoreElement();
+ webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
+ appsSectionContent.appendChild(webStoreEntry);
- data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
- appsMiniview.appendChild(apps.createMiniviewElement(app));
- addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app));
- });
+ data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
+ appsMiniview.appendChild(apps.createMiniviewElement(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)) {
- appsSection.classList.remove('disabled');
- }
+ if (!(shownSections & MINIMIZED_APPS)) {
+ appsSection.classList.remove('disabled');
}
addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS);
@@ -338,6 +340,21 @@ var apps = (function() {
});
elm.setAttribute('app-id', 'web-store-entry');
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;
}
};
})();
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 745ce0c..13c91fc 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -396,9 +396,6 @@ const char kEnableAccessibility[] = "enable-accessibility";
// Enables AeroPeek for each tab. (This switch only works on Windows 7).
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
// in response to a Negotiate challenge. See HttpAuthHandlerNegotiate::CreateSPN
// for more background.
@@ -452,10 +449,6 @@ const char kEnableContentPrefetch[] = "enable-content-prefetch";
// Enables web developers to create apps for Chrome without using crx packages.
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.
const char kEnableDeviceMotion[] = "enable-device-motion";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 139c084..4728bd3 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -121,7 +121,6 @@ extern const char kEnableAccelerated2dCanvas[];
extern const char kEnableAcceleratedLayers[];
extern const char kEnableAccessibility[];
extern const char kEnableAeroPeekTabs[];
-extern const char kEnableAppLauncher[];
extern const char kEnableAuthNegotiatePort[];
extern const char kEnableBackgroundMode[];
extern const char kEnableBenchmarking[];
@@ -135,7 +134,6 @@ extern const char kEnableConfirmToQuit[];
extern const char kEnableConnectBackupJobs[];
extern const char kEnableContentPrefetch[];
extern const char kEnableCrxlessWebApps[];
-extern const char kEnableDefaultApps[];
extern const char kEnableDeviceMotion[];
extern const char kEnableDNSCertProvenanceChecking[];
extern const char kEnableDNSSECCerts[];