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

Unified Diff: chrome/browser/resources/print_preview/data/app_state.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/data/app_state.js
diff --git a/chrome/browser/resources/print_preview/data/app_state.js b/chrome/browser/resources/print_preview/data/app_state.js
index 4abb18e97a4ac585547f2e8c45149e6445243a62..1e2b9d50450196243bbdd815f63d1beb0a4d1731 100644
--- a/chrome/browser/resources/print_preview/data/app_state.js
+++ b/chrome/browser/resources/print_preview/data/app_state.js
@@ -131,16 +131,16 @@ cr.define('print_preview', function() {
*/
get selectedDestination() {
return (this.state_[AppState.Field.RECENT_DESTINATIONS].length > 0) ?
- this.state_[AppState.Field.RECENT_DESTINATIONS][0] : null;
+ this.state_[AppState.Field.RECENT_DESTINATIONS][0] :
+ null;
},
/**
* @return {boolean} Whether the selected destination is valid.
*/
isSelectedDestinationValid: function() {
- return this.selectedDestination &&
- this.selectedDestination.id &&
- this.selectedDestination.origin;
+ return this.selectedDestination && this.selectedDestination.id &&
+ this.selectedDestination.origin;
},
/**
@@ -172,7 +172,8 @@ cr.define('print_preview', function() {
getField: function(field) {
if (field == AppState.Field.CUSTOM_MARGINS) {
return this.state_[field] ?
- print_preview.Margins.parse(this.state_[field]) : null;
+ print_preview.Margins.parse(this.state_[field]) :
+ null;
} else {
return this.state_[field];
}
@@ -191,7 +192,7 @@ cr.define('print_preview', function() {
if (state[AppState.Field.VERSION] == AppState.VERSION_) {
this.state_ = state;
}
- } catch(e) {
+ } catch (e) {
console.error('Unable to parse state: ' + e);
// Proceed with default state.
}
@@ -203,14 +204,16 @@ cr.define('print_preview', function() {
if (!this.state_[AppState.Field.RECENT_DESTINATIONS]) {
this.state_[AppState.Field.RECENT_DESTINATIONS] = [];
} else if (!(this.state_[AppState.Field.RECENT_DESTINATIONS] instanceof
- Array)) {
+ Array)) {
var tmp = this.state_[AppState.Field.RECENT_DESTINATIONS];
this.state_[AppState.Field.RECENT_DESTINATIONS] = [tmp];
- } else if (!this.state_[AppState.Field.RECENT_DESTINATIONS][0] ||
+ } else if (
+ !this.state_[AppState.Field.RECENT_DESTINATIONS][0] ||
!this.state_[AppState.Field.RECENT_DESTINATIONS][0].id) {
// read in incorrectly
this.state_[AppState.Field.RECENT_DESTINATIONS] = [];
- } else if (this.state_[AppState.Field.RECENT_DESTINATIONS].length >
+ } else if (
+ this.state_[AppState.Field.RECENT_DESTINATIONS].length >
AppState.NUM_DESTINATIONS_) {
this.state_[AppState.Field.RECENT_DESTINATIONS].length =
AppState.NUM_DESTINATIONS_;
@@ -254,10 +257,12 @@ cr.define('print_preview', function() {
// Determine if this destination is already in the recent destinations,
// and where in the array it is located.
var newDestination = new RecentDestination(dest);
- var indexFound = this.state_[
- AppState.Field.RECENT_DESTINATIONS].findIndex(function(recent) {
- return (newDestination.id == recent.id &&
- newDestination.origin == recent.origin);
+ var indexFound =
+ this.state_[AppState.Field.RECENT_DESTINATIONS].findIndex(function(
+ recent) {
+ return (
+ newDestination.id == recent.id &&
+ newDestination.origin == recent.origin);
});
// No change
@@ -270,7 +275,7 @@ cr.define('print_preview', function() {
// index n.
if (indexFound == -1 &&
this.state_[AppState.Field.RECENT_DESTINATIONS].length ==
- AppState.NUM_DESTINATIONS_) {
+ AppState.NUM_DESTINATIONS_) {
indexFound = AppState.NUM_DESTINATIONS_ - 1;
}
if (indexFound != -1)
@@ -300,12 +305,10 @@ cr.define('print_preview', function() {
* @private
*/
persist_: function() {
- chrome.send(AppState.NATIVE_FUNCTION_NAME_,
- [JSON.stringify(this.state_)]);
+ chrome.send(
+ AppState.NATIVE_FUNCTION_NAME_, [JSON.stringify(this.state_)]);
}
};
- return {
- AppState: AppState
- };
+ return {AppState: AppState};
});

Powered by Google App Engine
This is Rietveld 408576698