Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2017)

Unified Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 1305653002: Make the NTP apps page respect the enable hosted apps in windows flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-enable-hosted-apps-in-windows
Patch Set: Addressing reviewer feedback Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/apps_page.js
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index 751d9cea2eb6ea8bf3da40ac9e91a8173e6a0616..8136080e00827767e1f94f2f4a2b825a27229f52 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -50,7 +50,7 @@ cr.define('ntp', function() {
menu.appendChild(cr.ui.MenuItem.createSeparator());
this.launchRegularTab_ = this.appendMenuItem_('applaunchtyperegular');
this.launchPinnedTab_ = this.appendMenuItem_('applaunchtypepinned');
- if (loadTimeData.getBoolean('enableNewBookmarkApps') || !cr.isMac)
+ if (loadTimeData.getBoolean('canHostedAppsOpenInWindows'))
this.launchNewWindow_ = this.appendMenuItem_('applaunchtypewindow');
this.launchFullscreen_ = this.appendMenuItem_('applaunchtypefullscreen');
@@ -136,16 +136,25 @@ cr.define('ntp', function() {
this.launch_.textContent = app.appData.title;
var launchTypeWindow = this.launchNewWindow_;
+ var hasLaunchType = false;
this.forAllLaunchTypes_(function(launchTypeButton, id) {
launchTypeButton.disabled = false;
launchTypeButton.checked = app.appData.launch_type == id;
- // If bookmark apps are enabled, only show the "Open as window" button.
+ // There are three cases when a launch type is hidden:
+ // 1. packaged apps hide all launch types
+ // 2. canHostedAppsOpenInWindows is false and type is launchTypeWindow
+ // 3. enableNewBookmarkApps is true and type is anything except
+ // launchTypeWindow
launchTypeButton.hidden = app.appData.packagedApp ||
+ (!loadTimeData.getBoolean('canHostedAppsOpenInWindows') &&
+ launchTypeButton == launchTypeWindow) ||
(loadTimeData.getBoolean('enableNewBookmarkApps') &&
launchTypeButton != launchTypeWindow);
+ if (!launchTypeButton.hidden) hasLaunchType = true;
});
- this.launchTypeMenuSeparator_.hidden = app.appData.packagedApp;
+ this.launchTypeMenuSeparator_.hidden =
+ app.appData.packagedApp || !hasLaunchType;
this.options_.disabled = !app.appData.optionsUrl || !app.appData.enabled;
if (this.details_)
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698