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

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

Issue 8767002: make ntp apps promo work correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | no next file » | 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 */ 362 */
363 createAppsPromoExtras_: function() { 363 createAppsPromoExtras_: function() {
364 this.classList.add('webstore'); 364 this.classList.add('webstore');
365 365
366 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true); 366 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true);
367 this.appsPromoExtras_.id = ''; 367 this.appsPromoExtras_.id = '';
368 this.appsPromoHeading_ = 368 this.appsPromoHeading_ =
369 this.appsPromoExtras_.querySelector('.apps-promo-heading'); 369 this.appsPromoExtras_.querySelector('.apps-promo-heading');
370 this.appsPromoLink_ = 370 this.appsPromoLink_ =
371 this.appsPromoExtras_.querySelector('.apps-promo-link'); 371 this.appsPromoExtras_.querySelector('.apps-promo-link');
372 this.appsPromoLink_.addEventListener('click', this.onClick_.bind(this));
372 373
373 this.appsPromoLogo_ = this.ownerDocument.createElement('img'); 374 this.appsPromoLogo_ = this.ownerDocument.createElement('img');
374 this.appsPromoLogo_.className = 'apps-promo-logo'; 375 this.appsPromoLogo_.className = 'apps-promo-logo';
375 this.appImgContainer_.appendChild(this.appsPromoLogo_); 376 this.appImgContainer_.appendChild(this.appsPromoLogo_);
376 377
377 this.appendChild(this.appsPromoExtras_); 378 this.appendChild(this.appsPromoExtras_);
378 this.appsPromoExtras_.hidden = false; 379 this.appsPromoExtras_.hidden = false;
379 }, 380 },
380 381
381 /** 382 /**
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 431
431 /** 432 /**
432 * Invoked when an app is clicked. 433 * Invoked when an app is clicked.
433 * @param {Event} e The click event. 434 * @param {Event} e The click event.
434 * @private 435 * @private
435 */ 436 */
436 onClick_: function(e) { 437 onClick_: function(e) {
437 var is_promo = this.appsPromoExtras_ && 438 var is_promo = this.appsPromoExtras_ &&
438 window.getComputedStyle(this.appsPromoExtras_).display != 'none'; 439 window.getComputedStyle(this.appsPromoExtras_).display != 'none';
439 var url = !this.appData_.is_webstore ? '' : 440 var url = !this.appData_.is_webstore ? '' :
440 is_promo ? appendParam(this.appsPromoLink_.href, 441 is_promo ? this.appsPromoLink_.href :
441 'utm_source',
442 'chrome-ntp-promo') :
443 appendParam(this.appData_.url, 442 appendParam(this.appData_.url,
444 'utm_source', 443 'utm_source',
445 'chrome-ntp-icon'); 444 'chrome-ntp-icon');
446 445
447 chrome.send('launchApp', 446 chrome.send('launchApp',
448 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url, 447 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url,
449 e.altKey, e.ctrlKey, e.metaKey, e.shiftKey, e.button]); 448 e.altKey, e.ctrlKey, e.metaKey, e.shiftKey, e.button]);
450 449
451 // Don't allow the click to trigger a link or anything 450 // Don't allow the click to trigger a link or anything
452 e.preventDefault(); 451 e.preventDefault();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 appNotificationChanged: appNotificationChanged, 800 appNotificationChanged: appNotificationChanged,
802 AppsPage: AppsPage, 801 AppsPage: AppsPage,
803 launchAppAfterEnable: launchAppAfterEnable, 802 launchAppAfterEnable: launchAppAfterEnable,
804 }; 803 };
805 }); 804 });
806 805
807 // TODO(estade): update the content handlers to use ntp namespace instead of 806 // TODO(estade): update the content handlers to use ntp namespace instead of
808 // making these global. 807 // making these global.
809 var appNotificationChanged = ntp4.appNotificationChanged; 808 var appNotificationChanged = ntp4.appNotificationChanged;
810 var launchAppAfterEnable = ntp4.launchAppAfterEnable; 809 var launchAppAfterEnable = ntp4.launchAppAfterEnable;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698