OLD | NEW |
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 this.style.top = toCssPx(y); | 383 this.style.top = toCssPx(y); |
384 }, | 384 }, |
385 | 385 |
386 onBlur_: function(e) { | 386 onBlur_: function(e) { |
387 this.classList.remove('click-focus'); | 387 this.classList.remove('click-focus'); |
388 this.appContents_.classList.remove('suppress-active'); | 388 this.appContents_.classList.remove('suppress-active'); |
389 }, | 389 }, |
390 | 390 |
391 /** | 391 /** |
392 * Invoked when an app is clicked. | 392 * Invoked when an app is clicked. |
393 * @param {Event} e The click event. | 393 * @param {Event} e The click/auxclick event. |
394 * @private | 394 * @private |
395 */ | 395 */ |
396 onClick_: function(e) { | 396 onClick_: function(e) { |
397 var url = !this.appData_.is_webstore ? '' : | 397 var url = !this.appData_.is_webstore ? '' : |
398 appendParam(this.appData_.url, | 398 appendParam(this.appData_.url, |
399 'utm_source', | 399 'utm_source', |
400 'chrome-ntp-icon'); | 400 'chrome-ntp-icon'); |
401 | 401 |
402 chrome.send('launchApp', | 402 chrome.send('launchApp', |
403 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url, | 403 [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url, |
(...skipping 22 matching lines...) Expand all Loading... |
426 * Adds a node to the list of targets that will launch the app. This list | 426 * Adds a node to the list of targets that will launch the app. This list |
427 * is also used in onMousedown to determine whether the app contents should | 427 * is also used in onMousedown to determine whether the app contents should |
428 * be shown as active (if we don't do this, then clicking anywhere in | 428 * be shown as active (if we don't do this, then clicking anywhere in |
429 * appContents, even a part that is outside the ideally clickable region, | 429 * appContents, even a part that is outside the ideally clickable region, |
430 * will cause the app icon to look active). | 430 * will cause the app icon to look active). |
431 * @param {HTMLElement} node The node that should be clickable. | 431 * @param {HTMLElement} node The node that should be clickable. |
432 */ | 432 */ |
433 addLaunchClickTarget_: function(node) { | 433 addLaunchClickTarget_: function(node) { |
434 node.classList.add('launch-click-target'); | 434 node.classList.add('launch-click-target'); |
435 node.addEventListener('click', this.onClick_.bind(this)); | 435 node.addEventListener('click', this.onClick_.bind(this)); |
| 436 node.addEventListener('auxclick', this.onClick_.bind(this)); |
436 }, | 437 }, |
437 | 438 |
438 /** | 439 /** |
439 * Handler for mousedown on the App. Adds a class that allows us to | 440 * Handler for mousedown on the App. Adds a class that allows us to |
440 * not display as :active for right clicks (specifically, don't pulse on | 441 * not display as :active for right clicks (specifically, don't pulse on |
441 * these occasions). Also, we don't pulse for clicks that aren't within the | 442 * these occasions). Also, we don't pulse for clicks that aren't within the |
442 * clickable regions. | 443 * clickable regions. |
443 * @param {Event} e The mousedown event. | 444 * @param {Event} e The mousedown event. |
444 */ | 445 */ |
445 onMousedown_: function(e) { | 446 onMousedown_: function(e) { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); | 772 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); |
772 } | 773 } |
773 | 774 |
774 return { | 775 return { |
775 APP_LAUNCH: APP_LAUNCH, | 776 APP_LAUNCH: APP_LAUNCH, |
776 App: App, | 777 App: App, |
777 AppsPage: AppsPage, | 778 AppsPage: AppsPage, |
778 launchAppAfterEnable: launchAppAfterEnable, | 779 launchAppAfterEnable: launchAppAfterEnable, |
779 }; | 780 }; |
780 }); | 781 }); |
OLD | NEW |