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

Side by Side Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 883603002: Rename StreamlinedHostedApps to NewBookmarkApps in the code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments and variables Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('ntp', function() { 5 cr.define('ntp', function() {
6 'use strict'; 6 'use strict';
7 7
8 var APP_LAUNCH = { 8 var APP_LAUNCH = {
9 // The histogram buckets (keep in sync with extension_constants.h). 9 // The histogram buckets (keep in sync with extension_constants.h).
10 NTP_APPS_MAXIMIZED: 0, 10 NTP_APPS_MAXIMIZED: 0,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 initialize: function() { 42 initialize: function() {
43 var menu = new cr.ui.Menu; 43 var menu = new cr.ui.Menu;
44 cr.ui.decorate(menu, cr.ui.Menu); 44 cr.ui.decorate(menu, cr.ui.Menu);
45 menu.classList.add('app-context-menu'); 45 menu.classList.add('app-context-menu');
46 this.menu = menu; 46 this.menu = menu;
47 47
48 this.launch_ = this.appendMenuItem_(); 48 this.launch_ = this.appendMenuItem_();
49 this.launch_.addEventListener('activate', this.onLaunch_.bind(this)); 49 this.launch_.addEventListener('activate', this.onLaunch_.bind(this));
50 50
51 menu.appendChild(cr.ui.MenuItem.createSeparator()); 51 menu.appendChild(cr.ui.MenuItem.createSeparator());
52 if (loadTimeData.getBoolean('enableStreamlinedHostedApps')) 52 if (loadTimeData.getBoolean('enableNewBookmarkApps'))
53 this.launchRegularTab_ = this.appendMenuItem_('applaunchtypetab'); 53 this.launchRegularTab_ = this.appendMenuItem_('applaunchtypetab');
54 else 54 else
55 this.launchRegularTab_ = this.appendMenuItem_('applaunchtyperegular'); 55 this.launchRegularTab_ = this.appendMenuItem_('applaunchtyperegular');
56 this.launchPinnedTab_ = this.appendMenuItem_('applaunchtypepinned'); 56 this.launchPinnedTab_ = this.appendMenuItem_('applaunchtypepinned');
57 if (loadTimeData.getBoolean('enableStreamlinedHostedApps') || !cr.isMac) 57 if (loadTimeData.getBoolean('enableNewBookmarkApps') || !cr.isMac)
58 this.launchNewWindow_ = this.appendMenuItem_('applaunchtypewindow'); 58 this.launchNewWindow_ = this.appendMenuItem_('applaunchtypewindow');
59 this.launchFullscreen_ = this.appendMenuItem_('applaunchtypefullscreen'); 59 this.launchFullscreen_ = this.appendMenuItem_('applaunchtypefullscreen');
60 60
61 var self = this; 61 var self = this;
62 this.forAllLaunchTypes_(function(launchTypeButton, id) { 62 this.forAllLaunchTypes_(function(launchTypeButton, id) {
63 launchTypeButton.addEventListener('activate', 63 launchTypeButton.addEventListener('activate',
64 self.onLaunchTypeChanged_.bind(self)); 64 self.onLaunchTypeChanged_.bind(self));
65 }); 65 });
66 66
67 this.launchTypeMenuSeparator_ = cr.ui.MenuItem.createSeparator(); 67 this.launchTypeMenuSeparator_ = cr.ui.MenuItem.createSeparator();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 */ 128 */
129 setupForApp: function(app) { 129 setupForApp: function(app) {
130 this.app_ = app; 130 this.app_ = app;
131 131
132 this.launch_.textContent = app.appData.title; 132 this.launch_.textContent = app.appData.title;
133 133
134 var launchTypeRegularTab = this.launchRegularTab_; 134 var launchTypeRegularTab = this.launchRegularTab_;
135 this.forAllLaunchTypes_(function(launchTypeButton, id) { 135 this.forAllLaunchTypes_(function(launchTypeButton, id) {
136 launchTypeButton.disabled = false; 136 launchTypeButton.disabled = false;
137 launchTypeButton.checked = app.appData.launch_type == id; 137 launchTypeButton.checked = app.appData.launch_type == id;
138 // Streamlined hosted apps should only show the "Open as tab" button. 138 // If bookmark apps are enabled, only show the "Open as tab" button.
139 launchTypeButton.hidden = app.appData.packagedApp || 139 launchTypeButton.hidden = app.appData.packagedApp ||
140 (loadTimeData.getBoolean('enableStreamlinedHostedApps') && 140 (loadTimeData.getBoolean('enableNewBookmarkApps') &&
141 launchTypeButton != launchTypeRegularTab); 141 launchTypeButton != launchTypeRegularTab);
142 }); 142 });
143 143
144 this.launchTypeMenuSeparator_.hidden = app.appData.packagedApp; 144 this.launchTypeMenuSeparator_.hidden = app.appData.packagedApp;
145 145
146 this.options_.disabled = !app.appData.optionsUrl || !app.appData.enabled; 146 this.options_.disabled = !app.appData.optionsUrl || !app.appData.enabled;
147 this.details_.disabled = !app.appData.detailsUrl; 147 this.details_.disabled = !app.appData.detailsUrl;
148 this.uninstall_.disabled = !app.appData.mayDisable; 148 this.uninstall_.disabled = !app.appData.mayDisable;
149 149
150 if (cr.isMac) { 150 if (cr.isMac) {
(...skipping 10 matching lines...) Expand all
161 * @param {Event} e The activation event. 161 * @param {Event} e The activation event.
162 * @private 162 * @private
163 */ 163 */
164 onLaunch_: function(e) { 164 onLaunch_: function(e) {
165 chrome.send('launchApp', [this.app_.appId, APP_LAUNCH.NTP_APPS_MENU]); 165 chrome.send('launchApp', [this.app_.appId, APP_LAUNCH.NTP_APPS_MENU]);
166 }, 166 },
167 onLaunchTypeChanged_: function(e) { 167 onLaunchTypeChanged_: function(e) {
168 var pressed = e.currentTarget; 168 var pressed = e.currentTarget;
169 var app = this.app_; 169 var app = this.app_;
170 var targetLaunchType = pressed; 170 var targetLaunchType = pressed;
171 // Streamlined hosted apps can only toggle between open as window and open 171 // When bookmark apps are enabled, hosted apps can only toggle between
172 // as tab. 172 // open as window and open as tab.
173 if (loadTimeData.getBoolean('enableStreamlinedHostedApps')) { 173 if (loadTimeData.getBoolean('enableNewBookmarkApps')) {
174 targetLaunchType = this.launchRegularTab_.checked ? 174 targetLaunchType = this.launchRegularTab_.checked ?
175 this.launchNewWindow_ : this.launchRegularTab_; 175 this.launchNewWindow_ : this.launchRegularTab_;
176 } 176 }
177 this.forAllLaunchTypes_(function(launchTypeButton, id) { 177 this.forAllLaunchTypes_(function(launchTypeButton, id) {
178 if (launchTypeButton == targetLaunchType) { 178 if (launchTypeButton == targetLaunchType) {
179 chrome.send('setLaunchType', [app.appId, id]); 179 chrome.send('setLaunchType', [app.appId, id]);
180 // Manually update the launch type. We will only get 180 // Manually update the launch type. We will only get
181 // appsPrefChangeCallback calls after changes to other NTP instances. 181 // appsPrefChangeCallback calls after changes to other NTP instances.
182 app.appData.launch_type = id; 182 app.appData.launch_type = id;
183 } 183 }
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 function launchAppAfterEnable(appId) { 770 function launchAppAfterEnable(appId) {
771 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); 771 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]);
772 } 772 }
773 773
774 return { 774 return {
775 APP_LAUNCH: APP_LAUNCH, 775 APP_LAUNCH: APP_LAUNCH,
776 AppsPage: AppsPage, 776 AppsPage: AppsPage,
777 launchAppAfterEnable: launchAppAfterEnable, 777 launchAppAfterEnable: launchAppAfterEnable,
778 }; 778 };
779 }); 779 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698