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

Unified Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ntp4/apps_page.js
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index 270dfecea5d9635215bab3d6d44bca38865d1a31..b7679ce9ef3fb65cef6f8755ab39a5d4c87035fe 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -21,7 +21,7 @@ cr.define('ntp', function() {
SAME_APPS_PANE: 0,
OTHER_APPS_PANE: 1,
MOST_VISITED_PANE: 2, // Deprecated.
- BOOKMARKS_PANE: 3, // Deprecated.
+ BOOKMARKS_PANE: 3, // Deprecated.
OUTSIDE_NTP: 4
};
var DRAG_SOURCE_LIMIT = DRAG_SOURCE.OUTSIDE_NTP + 1;
@@ -56,8 +56,8 @@ cr.define('ntp', function() {
var self = this;
this.forAllLaunchTypes_(function(launchTypeButton, id) {
- launchTypeButton.addEventListener('activate',
- self.onLaunchTypeChanged_.bind(self));
+ launchTypeButton.addEventListener(
+ 'activate', self.onLaunchTypeChanged_.bind(self));
});
this.launchTypeMenuSeparator_ = cr.ui.MenuItem.createSeparator();
@@ -67,18 +67,18 @@ cr.define('ntp', function() {
if (loadTimeData.getBoolean('canShowAppInfoDialog')) {
this.appinfo_ = this.appendMenuItem_('appinfodialog');
- this.appinfo_.addEventListener('activate',
- this.onShowAppInfo_.bind(this));
+ this.appinfo_.addEventListener(
+ 'activate', this.onShowAppInfo_.bind(this));
} else {
this.details_ = this.appendMenuItem_('appdetails');
- this.details_.addEventListener('activate',
- this.onShowDetails_.bind(this));
+ this.details_.addEventListener(
+ 'activate', this.onShowDetails_.bind(this));
}
- this.options_.addEventListener('activate',
- this.onShowOptions_.bind(this));
- this.uninstall_.addEventListener('activate',
- this.onUninstall_.bind(this));
+ this.options_.addEventListener(
+ 'activate', this.onShowOptions_.bind(this));
+ this.uninstall_.addEventListener(
+ 'activate', this.onUninstall_.bind(this));
if (!cr.isChromeOS) {
this.createShortcutSeparator_ =
@@ -115,10 +115,10 @@ cr.define('ntp', function() {
*/
forAllLaunchTypes_: function(f) {
// Order matters: index matches launchType id.
- var launchTypes = [this.launchPinnedTab_,
- this.launchRegularTab_,
- this.launchFullscreen_,
- this.launchNewWindow_];
+ var launchTypes = [
+ this.launchPinnedTab_, this.launchRegularTab_, this.launchFullscreen_,
+ this.launchNewWindow_
+ ];
for (var i = 0; i < launchTypes.length; ++i) {
if (!launchTypes[i])
@@ -152,7 +152,8 @@ cr.define('ntp', function() {
launchTypeButton == launchTypeWindow) ||
(loadTimeData.getBoolean('enableNewBookmarkApps') &&
launchTypeButton != launchTypeWindow);
- if (!launchTypeButton.hidden) hasLaunchType = true;
+ if (!launchTypeButton.hidden)
+ hasLaunchType = true;
});
this.launchTypeMenuSeparator_.hidden =
@@ -189,7 +190,8 @@ cr.define('ntp', function() {
// open as window and open as tab.
if (loadTimeData.getBoolean('enableNewBookmarkApps')) {
targetLaunchType = this.launchNewWindow_.checked ?
- this.launchRegularTab_ : this.launchNewWindow_;
+ this.launchRegularTab_ :
+ this.launchNewWindow_;
}
this.forAllLaunchTypes_(function(launchTypeButton, id) {
if (launchTypeButton == targetLaunchType) {
@@ -262,8 +264,8 @@ cr.define('ntp', function() {
this.appContents_.id = '';
this.appendChild(this.appContents_);
- this.appImgContainer_ = /** @type {HTMLElement} */(
- this.querySelector('.app-img-container'));
+ this.appImgContainer_ =
+ /** @type {HTMLElement} */ (this.querySelector('.app-img-container'));
this.appImg_ = this.appImgContainer_.querySelector('img');
this.setIcon();
@@ -272,7 +274,7 @@ cr.define('ntp', function() {
// The app's full name is shown in the tooltip, whereas the short name
// is used for the label.
- var appSpan = /** @type {HTMLElement} */(
+ var appSpan = /** @type {HTMLElement} */ (
this.appContents_.querySelector('.title'));
appSpan.textContent = this.appData_.title;
appSpan.title = this.appData_.full_name;
@@ -289,8 +291,8 @@ cr.define('ntp', function() {
});
if (!this.appData_.kioskMode) {
- this.appContents_.addEventListener('contextmenu',
- cr.ui.contextMenuHandler);
+ this.appContents_.addEventListener(
+ 'contextmenu', cr.ui.contextMenuHandler);
}
this.addEventListener('mousedown', this.onMousedown_, true);
@@ -373,12 +375,13 @@ cr.define('ntp', function() {
* @private
*/
onClick_: function(e) {
- if (/** @type {MouseEvent} */(e).button > 1)
+ if (/** @type {MouseEvent} */ (e).button > 1)
return;
- chrome.send('launchApp',
- [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, 'chrome-ntp-icon',
- e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]);
+ chrome.send('launchApp', [
+ this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, 'chrome-ntp-icon', e.button,
+ e.altKey, e.ctrlKey, e.metaKey, e.shiftKey
+ ]);
// Don't allow the click to trigger a link or anything
e.preventDefault();
@@ -391,9 +394,10 @@ cr.define('ntp', function() {
*/
onKeydown_: function(e) {
if (e.key == 'Enter') {
- chrome.send('launchApp',
- [this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, '',
- 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]);
+ chrome.send('launchApp', [
+ this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, '', 0, e.altKey, e.ctrlKey,
+ e.metaKey, e.shiftKey
+ ]);
e.preventDefault();
e.stopPropagation();
}
@@ -429,8 +433,8 @@ cr.define('ntp', function() {
e.preventDefault();
if (e.button == 2 ||
- !findAncestorByClass(/** @type {Element} */(e.target),
- 'launch-click-target')) {
+ !findAncestorByClass(
+ /** @type {Element} */ (e.target), 'launch-click-target')) {
this.appContents_.classList.add('suppress-active');
} else {
this.appContents_.classList.remove('suppress-active');
@@ -455,11 +459,17 @@ cr.define('ntp', function() {
* The data and preferences for this app.
* @type {Object}
*/
- set appData(data) { this.appData_ = data; },
- get appData() { return this.appData_; },
+ set appData(data) {
+ this.appData_ = data;
+ },
+ get appData() {
+ return this.appData_;
+ },
/** @type {string} */
- get appId() { return this.appData_.id; },
+ get appId() {
+ return this.appData_.id;
+ },
/**
* Returns a pointer to the context menu for this app. All apps share the
@@ -478,7 +488,9 @@ cr.define('ntp', function() {
* the user can drag it onto the trash and expect something to happen).
* @return {boolean} True if the app can be uninstalled.
*/
- canBeRemoved: function() { return this.appData_.mayDisable; },
+ canBeRemoved: function() {
+ return this.appData_.mayDisable;
+ },
/**
* Uninstalls the app after it's been dropped on the trash.
@@ -630,8 +642,8 @@ cr.define('ntp', function() {
return true;
if (!e.dataTransfer || !e.dataTransfer.types)
return false;
- return Array.prototype.indexOf.call(e.dataTransfer.types,
- 'text/uri-list') != -1;
+ return Array.prototype.indexOf.call(
+ e.dataTransfer.types, 'text/uri-list') != -1;
},
/** @override */
@@ -645,8 +657,8 @@ cr.define('ntp', function() {
var samePageDrag = originalPage == this;
sourceId = samePageDrag ? DRAG_SOURCE.SAME_APPS_PANE :
DRAG_SOURCE.OTHER_APPS_PANE;
- this.tileGrid_.insertBefore(currentlyDraggingTile,
- this.tileElements_[index]);
+ this.tileGrid_.insertBefore(
+ currentlyDraggingTile, this.tileElements_[index]);
this.tileMoved(currentlyDraggingTile);
if (!samePageDrag) {
originalPage.fireRemovedEvent(currentlyDraggingTile, index, true);
@@ -659,7 +671,8 @@ cr.define('ntp', function() {
}
assert(sourceId != -1);
- chrome.send('metricsHandler:recordInHistogram',
+ chrome.send(
+ 'metricsHandler:recordInHistogram',
['NewTabPage.AppsPageDragSource', sourceId, DRAG_SOURCE_LIMIT]);
},

Powered by Google App Engine
This is Rietveld 408576698