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

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

Issue 899173002: Replace Webstore link with app info dialog link in chrome://apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reformat Created 5 years, 10 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 var self = this; 58 var self = this;
59 this.forAllLaunchTypes_(function(launchTypeButton, id) { 59 this.forAllLaunchTypes_(function(launchTypeButton, id) {
60 launchTypeButton.addEventListener('activate', 60 launchTypeButton.addEventListener('activate',
61 self.onLaunchTypeChanged_.bind(self)); 61 self.onLaunchTypeChanged_.bind(self));
62 }); 62 });
63 63
64 this.launchTypeMenuSeparator_ = cr.ui.MenuItem.createSeparator(); 64 this.launchTypeMenuSeparator_ = cr.ui.MenuItem.createSeparator();
65 menu.appendChild(this.launchTypeMenuSeparator_); 65 menu.appendChild(this.launchTypeMenuSeparator_);
66 this.options_ = this.appendMenuItem_('appoptions'); 66 this.options_ = this.appendMenuItem_('appoptions');
67 this.details_ = this.appendMenuItem_('appdetails');
68 this.uninstall_ = this.appendMenuItem_('appuninstall'); 67 this.uninstall_ = this.appendMenuItem_('appuninstall');
68
69 if (loadTimeData.getBoolean('canShowAppInfoDialog')) {
70 this.appinfo_ = this.appendMenuItem_('appinfodialog');
71 this.appinfo_.addEventListener('activate',
72 this.onShowAppInfo_.bind(this));
73 } else {
74 this.details_ = this.appendMenuItem_('appdetails');
75 this.details_.addEventListener('activate',
76 this.onShowDetails_.bind(this));
77 }
78
69 this.options_.addEventListener('activate', 79 this.options_.addEventListener('activate',
70 this.onShowOptions_.bind(this)); 80 this.onShowOptions_.bind(this));
71 this.details_.addEventListener('activate', 81
72 this.onShowDetails_.bind(this));
73 this.uninstall_.addEventListener('activate', 82 this.uninstall_.addEventListener('activate',
74 this.onUninstall_.bind(this)); 83 this.onUninstall_.bind(this));
75 84
76 if (!cr.isChromeOS) { 85 if (!cr.isChromeOS) {
77 this.createShortcutSeparator_ = 86 this.createShortcutSeparator_ =
78 menu.appendChild(cr.ui.MenuItem.createSeparator()); 87 menu.appendChild(cr.ui.MenuItem.createSeparator());
79 this.createShortcut_ = this.appendMenuItem_('appcreateshortcut'); 88 this.createShortcut_ = this.appendMenuItem_('appcreateshortcut');
80 this.createShortcut_.addEventListener( 89 this.createShortcut_.addEventListener(
81 'activate', this.onCreateShortcut_.bind(this)); 90 'activate', this.onCreateShortcut_.bind(this));
82 } 91 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 launchTypeButton.checked = app.appData.launch_type == id; 143 launchTypeButton.checked = app.appData.launch_type == id;
135 // If bookmark apps are enabled, only show the "Open as window" button. 144 // If bookmark apps are enabled, only show the "Open as window" button.
136 launchTypeButton.hidden = app.appData.packagedApp || 145 launchTypeButton.hidden = app.appData.packagedApp ||
137 (loadTimeData.getBoolean('enableNewBookmarkApps') && 146 (loadTimeData.getBoolean('enableNewBookmarkApps') &&
138 launchTypeButton != launchTypeWindow); 147 launchTypeButton != launchTypeWindow);
139 }); 148 });
140 149
141 this.launchTypeMenuSeparator_.hidden = app.appData.packagedApp; 150 this.launchTypeMenuSeparator_.hidden = app.appData.packagedApp;
142 151
143 this.options_.disabled = !app.appData.optionsUrl || !app.appData.enabled; 152 this.options_.disabled = !app.appData.optionsUrl || !app.appData.enabled;
144 this.details_.disabled = !app.appData.detailsUrl; 153 if (this.details_)
154 this.details_.disabled = !app.appData.detailsUrl;
145 this.uninstall_.disabled = !app.appData.mayDisable; 155 this.uninstall_.disabled = !app.appData.mayDisable;
146 156
147 if (cr.isMac) { 157 if (cr.isMac) {
148 // On Windows and Linux, these should always be visible. On ChromeOS, 158 // On Windows and Linux, these should always be visible. On ChromeOS,
149 // they are never created. On Mac, shortcuts can only be created for 159 // they are never created. On Mac, shortcuts can only be created for
150 // new-style packaged apps, so hide the menu item. 160 // new-style packaged apps, so hide the menu item.
151 this.createShortcutSeparator_.hidden = this.createShortcut_.hidden = 161 this.createShortcutSeparator_.hidden = this.createShortcut_.hidden =
152 !app.appData.packagedApp; 162 !app.appData.packagedApp;
153 } 163 }
154 }, 164 },
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 var url = this.app_.appData.detailsUrl; 197 var url = this.app_.appData.detailsUrl;
188 url = appendParam(url, 'utm_source', 'chrome-ntp-launcher'); 198 url = appendParam(url, 'utm_source', 'chrome-ntp-launcher');
189 window.location = url; 199 window.location = url;
190 }, 200 },
191 onUninstall_: function(e) { 201 onUninstall_: function(e) {
192 chrome.send('uninstallApp', [this.app_.appData.id]); 202 chrome.send('uninstallApp', [this.app_.appData.id]);
193 }, 203 },
194 onCreateShortcut_: function(e) { 204 onCreateShortcut_: function(e) {
195 chrome.send('createAppShortcut', [this.app_.appData.id]); 205 chrome.send('createAppShortcut', [this.app_.appData.id]);
196 }, 206 },
207 onShowAppInfo_: function(e) {
208 chrome.send('showAppInfo', [this.app_.appData.id]);
209 }
197 }; 210 };
198 211
199 /** 212 /**
200 * Creates a new App object. 213 * Creates a new App object.
201 * @param {Object} appData The data object that describes the app. 214 * @param {Object} appData The data object that describes the app.
202 * @constructor 215 * @constructor
203 * @extends {HTMLDivElement} 216 * @extends {HTMLDivElement}
204 */ 217 */
205 function App(appData) { 218 function App(appData) {
206 var el = cr.doc.createElement('div'); 219 var el = cr.doc.createElement('div');
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 function launchAppAfterEnable(appId) { 780 function launchAppAfterEnable(appId) {
768 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); 781 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]);
769 } 782 }
770 783
771 return { 784 return {
772 APP_LAUNCH: APP_LAUNCH, 785 APP_LAUNCH: APP_LAUNCH,
773 AppsPage: AppsPage, 786 AppsPage: AppsPage,
774 launchAppAfterEnable: launchAppAfterEnable, 787 launchAppAfterEnable: launchAppAfterEnable,
775 }; 788 };
776 }); 789 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/apps/app_info_dialog.h » ('j') | chrome/browser/ui/apps/app_info_dialog.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698