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

Unified Diff: chrome/browser/resources/print_preview/search/destination_search.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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/print_preview/search/destination_search.js
diff --git a/chrome/browser/resources/print_preview/search/destination_search.js b/chrome/browser/resources/print_preview/search/destination_search.js
index ff1957341397ba17d089d6208d31120eac64daab..0d4b24e09f9a30c7f134adea80040974480369b6 100644
--- a/chrome/browser/resources/print_preview/search/destination_search.js
+++ b/chrome/browser/resources/print_preview/search/destination_search.js
@@ -96,10 +96,10 @@ cr.define('print_preview', function() {
* @private
*/
this.localList_ = new print_preview.DestinationList(
- this,
- loadTimeData.getString('localDestinationsTitle'),
+ this, loadTimeData.getString('localDestinationsTitle'),
loadTimeData.getBoolean('showLocalManageButton') ?
- loadTimeData.getString('manage') : null);
+ loadTimeData.getString('manage') :
+ null);
this.addChild(this.localList_);
/**
@@ -173,8 +173,8 @@ cr.define('print_preview', function() {
/** @override */
onCancelInternal: function() {
- this.metrics_.record(print_preview.Metrics.DestinationSearchBucket.
- DESTINATION_CLOSED_UNCHANGED);
+ this.metrics_.record(print_preview.Metrics.DestinationSearchBucket
+ .DESTINATION_CLOSED_UNCHANGED);
},
/** Shows the Google Cloud Print promotion banner. */
@@ -195,42 +195,35 @@ cr.define('print_preview', function() {
print_preview.Overlay.prototype.enterDocument.call(this);
this.tracker.add(
- this.getChildElement('.account-select'),
- 'change',
+ this.getChildElement('.account-select'), 'change',
this.onAccountChange_.bind(this));
this.tracker.add(
- this.getChildElement('.sign-in'),
- 'click',
+ this.getChildElement('.sign-in'), 'click',
this.onSignInActivated_.bind(this));
this.tracker.add(
- this.getChildElement('.invitation-accept-button'),
- 'click',
+ this.getChildElement('.invitation-accept-button'), 'click',
this.onInvitationProcessButtonClick_.bind(this, true /*accept*/));
this.tracker.add(
- this.getChildElement('.invitation-reject-button'),
- 'click',
+ this.getChildElement('.invitation-reject-button'), 'click',
this.onInvitationProcessButtonClick_.bind(this, false /*accept*/));
this.tracker.add(
- this.getChildElement('.cloudprint-promo > .close-button'),
- 'click',
+ this.getChildElement('.cloudprint-promo > .close-button'), 'click',
this.onCloudprintPromoCloseButtonClick_.bind(this));
this.tracker.add(
- this.searchBox_,
- print_preview.SearchBox.EventType.SEARCH,
+ this.searchBox_, print_preview.SearchBox.EventType.SEARCH,
this.onSearch_.bind(this));
this.tracker.add(
- this,
- print_preview.DestinationListItem.EventType.SELECT,
+ this, print_preview.DestinationListItem.EventType.SELECT,
this.onDestinationSelect_.bind(this));
this.tracker.add(
this,
print_preview.DestinationListItem.EventType.REGISTER_PROMO_CLICKED,
function() {
- this.metrics_.record(print_preview.Metrics.DestinationSearchBucket.
- REGISTER_PROMO_SELECTED);
+ this.metrics_.record(print_preview.Metrics.DestinationSearchBucket
+ .REGISTER_PROMO_SELECTED);
}.bind(this));
this.tracker.add(
@@ -250,9 +243,8 @@ cr.define('print_preview', function() {
print_preview.DestinationStore.EventType.DESTINATION_SEARCH_DONE,
this.onDestinationSearchDone_.bind(this));
this.tracker.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType
- .PROVISIONAL_DESTINATION_RESOLVED,
+ this.destinationStore_, print_preview.DestinationStore.EventType
+ .PROVISIONAL_DESTINATION_RESOLVED,
this.onDestinationsInserted_.bind(this));
this.tracker.add(
@@ -274,13 +266,11 @@ cr.define('print_preview', function() {
this.onManageCloudDestinationsActivated_.bind(this));
this.tracker.add(
- this.userInfo_,
- print_preview.UserInfo.EventType.USERS_CHANGED,
+ this.userInfo_, print_preview.UserInfo.EventType.USERS_CHANGED,
this.onUsersChanged_.bind(this));
this.tracker.add(
- this.getChildElement('.button-strip .cancel-button'),
- 'click',
+ this.getChildElement('.button-strip .cancel-button'), 'click',
this.cancel.bind(this));
this.tracker.add(window, 'resize', this.onWindowResize_.bind(this));
@@ -298,8 +288,7 @@ cr.define('print_preview', function() {
this.localList_.render(this.getChildElement('.local-list'));
this.cloudList_.render(this.getChildElement('.cloud-list'));
this.getChildElement('.promo-text').innerHTML = loadTimeData.getStringF(
- 'cloudPrintPromotion',
- '<a is="action-link" class="sign-in">',
+ 'cloudPrintPromotion', '<a is="action-link" class="sign-in">',
'</a>');
this.getChildElement('.account-select-label').textContent =
loadTimeData.getString('accountSelectTitle');
@@ -361,7 +350,7 @@ cr.define('print_preview', function() {
localDestinations.push(destination);
} else {
if (destination.connectionStatus ==
- print_preview.Destination.ConnectionStatus.UNREGISTERED) {
+ print_preview.Destination.ConnectionStatus.UNREGISTERED) {
unregisteredCloudDestinations.push(destination);
} else {
cloudDestinations.push(destination);
@@ -376,11 +365,13 @@ cr.define('print_preview', function() {
this.registerPromoShownMetricRecorded_ = true;
}
- var finalCloudDestinations = unregisteredCloudDestinations.slice(
- 0, DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_).concat(
- cloudDestinations,
- unregisteredCloudDestinations.slice(
- DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_));
+ var finalCloudDestinations =
+ unregisteredCloudDestinations
+ .slice(0, DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_)
+ .concat(
+ cloudDestinations,
+ unregisteredCloudDestinations.slice(
+ DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_));
this.recentList_.updateDestinations(recentDestinations);
this.localList_.updateDestinations(localDestinations);
@@ -410,7 +401,9 @@ cr.define('print_preview', function() {
}, 0);
};
var getCounts = function(lists, count) {
- return lists.map(function(list) { return count; });
+ return lists.map(function(list) {
+ return count;
+ });
};
var availableHeight = this.getAvailableListsHeight_();
@@ -478,11 +471,12 @@ cr.define('print_preview', function() {
*/
updateInvitations_: function() {
var invitations = this.userInfo_.activeUser ?
- this.invitationStore_.invitations(this.userInfo_.activeUser) : [];
+ this.invitationStore_.invitations(this.userInfo_.activeUser) :
+ [];
if (invitations.length > 0) {
if (this.invitation_ != invitations[0]) {
- this.metrics_.record(print_preview.Metrics.DestinationSearchBucket.
- INVITATION_AVAILABLE);
+ this.metrics_.record(print_preview.Metrics.DestinationSearchBucket
+ .INVITATION_AVAILABLE);
}
this.invitation_ = invitations[0];
this.showInvitation_(this.invitation_);
@@ -502,14 +496,12 @@ cr.define('print_preview', function() {
var invitationText = '';
if (invitation.asGroupManager) {
invitationText = loadTimeData.getStringF(
- 'groupPrinterSharingInviteText',
- HTMLEscape(invitation.sender),
+ 'groupPrinterSharingInviteText', HTMLEscape(invitation.sender),
HTMLEscape(invitation.destination.displayName),
HTMLEscape(invitation.receiver));
} else {
invitationText = loadTimeData.getStringF(
- 'printerSharingInviteText',
- HTMLEscape(invitation.sender),
+ 'printerSharingInviteText', HTMLEscape(invitation.sender),
HTMLEscape(invitation.destination.displayName));
}
this.getChildElement('.invitation-text').innerHTML = invitationText;
@@ -584,13 +576,15 @@ cr.define('print_preview', function() {
*/
handleOnDestinationSelect_: function(destination) {
if (destination.isProvisional) {
- assert(!this.provisionalDestinationResolver_,
- 'Provisional destination resolver already exists.');
+ assert(
+ !this.provisionalDestinationResolver_,
+ 'Provisional destination resolver already exists.');
this.provisionalDestinationResolver_ =
print_preview.ProvisionalDestinationResolver.create(
this.destinationStore_, destination);
- assert(!!this.provisionalDestinationResolver_,
- 'Unable to create provisional destination resolver');
+ assert(
+ !!this.provisionalDestinationResolver_,
+ 'Unable to create provisional destination resolver');
var lastFocusedElement = document.activeElement;
this.addChild(this.provisionalDestinationResolver_);
@@ -604,32 +598,30 @@ cr.define('print_preview', function() {
function(resolvedDestination) {
this.handleOnDestinationSelect_(resolvedDestination);
}.bind(this))
- .catch(
- function() {
- console.log('Failed to resolve provisional destination: ' +
- destination.id);
- })
- .then(
- function() {
- this.removeChild(this.provisionalDestinationResolver_);
- this.provisionalDestinationResolver_ = null;
-
- // Restore focus to the previosly focused element if it's
- // still shown in the search.
- if (lastFocusedElement &&
- this.getIsVisible() &&
- getIsVisible(lastFocusedElement) &&
- this.getElement().contains(lastFocusedElement)) {
- lastFocusedElement.focus();
- }
- }.bind(this));
+ .catch(function() {
+ console.log(
+ 'Failed to resolve provisional destination: ' +
+ destination.id);
+ })
+ .then(function() {
+ this.removeChild(this.provisionalDestinationResolver_);
+ this.provisionalDestinationResolver_ = null;
+
+ // Restore focus to the previosly focused element if it's
+ // still shown in the search.
+ if (lastFocusedElement && this.getIsVisible() &&
+ getIsVisible(lastFocusedElement) &&
+ this.getElement().contains(lastFocusedElement)) {
+ lastFocusedElement.focus();
+ }
+ }.bind(this));
return;
}
this.setIsVisible(false);
this.destinationStore_.selectDestination(destination);
- this.metrics_.record(print_preview.Metrics.DestinationSearchBucket.
- DESTINATION_CLOSED_CHANGED);
+ this.metrics_.record(print_preview.Metrics.DestinationSearchBucket
+ .DESTINATION_CLOSED_CHANGED);
},
/**
@@ -740,9 +732,12 @@ cr.define('print_preview', function() {
* @private
*/
onInvitationProcessButtonClick_: function(accept) {
- this.metrics_.record(accept ?
- print_preview.Metrics.DestinationSearchBucket.INVITATION_ACCEPTED :
- print_preview.Metrics.DestinationSearchBucket.INVITATION_REJECTED);
+ this.metrics_.record(
+ accept ?
+ print_preview.Metrics.DestinationSearchBucket
+ .INVITATION_ACCEPTED :
+ print_preview.Metrics.DestinationSearchBucket
+ .INVITATION_REJECTED);
this.invitationStore_.processInvitation(this.invitation_, accept);
this.updateInvitations_();
},
@@ -767,7 +762,5 @@ cr.define('print_preview', function() {
};
// Export
- return {
- DestinationSearch: DestinationSearch
- };
+ return {DestinationSearch: DestinationSearch};
});

Powered by Google App Engine
This is Rietveld 408576698