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

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

Issue 7662001: ntp4: remove apps promo 'no, thanks' link. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rbyers review Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/ntp4/apps_page.css ('k') | chrome/browser/resources/ntp4/new_tab.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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('ntp4', function() { 5 cr.define('ntp4', function() {
6 'use strict'; 6 'use strict';
7 7
8 var localStrings = new LocalStrings; 8 var localStrings = new LocalStrings;
9 9
10 var APP_LAUNCH = { 10 var APP_LAUNCH = {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 */ 236 */
237 createAppsPromoExtras_: function() { 237 createAppsPromoExtras_: function() {
238 this.classList.add('webstore'); 238 this.classList.add('webstore');
239 239
240 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true); 240 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true);
241 this.appsPromoExtras_.id = ''; 241 this.appsPromoExtras_.id = '';
242 this.appsPromoHeading_ = 242 this.appsPromoHeading_ =
243 this.appsPromoExtras_.querySelector('.apps-promo-heading'); 243 this.appsPromoExtras_.querySelector('.apps-promo-heading');
244 this.appsPromoLink_ = 244 this.appsPromoLink_ =
245 this.appsPromoExtras_.querySelector('.apps-promo-link'); 245 this.appsPromoExtras_.querySelector('.apps-promo-link');
246 this.appsPromoHide_ =
247 this.appsPromoExtras_.querySelector('.apps-promo-hide');
248 246
249 this.appsPromoLogo_ = this.ownerDocument.createElement('img'); 247 this.appsPromoLogo_ = this.ownerDocument.createElement('img');
250 this.appsPromoLogo_.className = 'apps-promo-logo'; 248 this.appsPromoLogo_.className = 'apps-promo-logo';
251 this.appImgContainer_.appendChild(this.appsPromoLogo_); 249 this.appImgContainer_.appendChild(this.appsPromoLogo_);
252 250
253 this.appsPromoHide_.addEventListener('click',
254 this.onHidePromoClicked_.bind(this));
255
256 this.appendChild(this.appsPromoExtras_); 251 this.appendChild(this.appsPromoExtras_);
257 this.appsPromoExtras_.hidden = false; 252 this.appsPromoExtras_.hidden = false;
258 }, 253 },
259 254
260 /** 255 /**
261 * Handles when the "No, thanks" promo link is clicked.
262 * @private
263 */
264 onHidePromoClicked_: function(e) {
265 chrome.send('hideAppsPromo');
266 this.setAppsPromoData(null);
267 },
268
269 /**
270 * Sets the apps promo appearance. If |data| is null, there is no promo. If 256 * Sets the apps promo appearance. If |data| is null, there is no promo. If
271 * |data| is non-null, it contains strings to be shown for the promo. The 257 * |data| is non-null, it contains strings to be shown for the promo. The
272 * promo is only shown when the webstore app icon is alone on a page. 258 * promo is only shown when the webstore app icon is alone on a page.
273 * @param {Object} data A dictionary that contains apps promo strings. 259 * @param {Object} data A dictionary that contains apps promo strings.
274 */ 260 */
275 setAppsPromoData: function(data) { 261 setAppsPromoData: function(data) {
276 if (data) { 262 if (data) {
277 this.classList.add('has-promo'); 263 this.classList.add('has-promo');
278 } else { 264 } else {
279 this.classList.remove('has-promo'); 265 this.classList.remove('has-promo');
280 return; 266 return;
281 } 267 }
282 268
283 this.appsPromoHeading_.textContent = data.promoHeader; 269 this.appsPromoHeading_.textContent = data.promoHeader;
284 this.appsPromoLink_.href = data.promoLink; 270 this.appsPromoLink_.href = data.promoLink;
285 this.appsPromoLink_.textContent = data.promoButton; 271 this.appsPromoLink_.textContent = data.promoButton;
286 this.appsPromoHide_.textContent = data.promoExpire;
287 this.appsPromoLogo_.src = data.promoLogo; 272 this.appsPromoLogo_.src = data.promoLogo;
288 }, 273 },
289 274
290 /** 275 /**
291 * Set the size and position of the app tile. 276 * Set the size and position of the app tile.
292 * @param {number} size The total size of |this|. 277 * @param {number} size The total size of |this|.
293 * @param {number} x The x-position. 278 * @param {number} x The x-position.
294 * @param {number} y The y-position. 279 * @param {number} y The y-position.
295 * animate. 280 * animate.
296 */ 281 */
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 var store = document.querySelector('.webstore'); 499 var store = document.querySelector('.webstore');
515 if (store) 500 if (store)
516 store.setAppsPromoData(data); 501 store.setAppsPromoData(data);
517 }; 502 };
518 503
519 return { 504 return {
520 APP_LAUNCH: APP_LAUNCH, 505 APP_LAUNCH: APP_LAUNCH,
521 AppsPage: AppsPage, 506 AppsPage: AppsPage,
522 }; 507 };
523 }); 508 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/apps_page.css ('k') | chrome/browser/resources/ntp4/new_tab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698