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

Side by Side Diff: chrome/browser/resources/settings/people_page/import_data_dialog.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview 'settings-import-data-dialog' is a component for importing 6 * @fileoverview 'settings-import-data-dialog' is a component for importing
7 * bookmarks and other data from other sources. 7 * bookmarks and other data from other sources.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-import-data-dialog', 10 is: 'settings-import-data-dialog',
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 this.closeDialog_(); 73 this.closeDialog_();
74 }.bind(this)); 74 }.bind(this));
75 }, 75 },
76 76
77 /** @private */ 77 /** @private */
78 prefsChanged_: function() { 78 prefsChanged_: function() {
79 this.noImportDataTypeSelected_ = 79 this.noImportDataTypeSelected_ =
80 !(this.getPref('import_history').value && this.selected_.history) && 80 !(this.getPref('import_history').value && this.selected_.history) &&
81 !(this.getPref('import_bookmarks').value && this.selected_.favorites) && 81 !(this.getPref('import_bookmarks').value && this.selected_.favorites) &&
82 !(this.getPref('import_saved_passwords').value && 82 !(this.getPref('import_saved_passwords').value &&
83 this.selected_.passwords) && 83 this.selected_.passwords) &&
84 !(this.getPref('import_search_engine').value && 84 !(this.getPref('import_search_engine').value &&
85 this.selected_.search) && 85 this.selected_.search) &&
86 !(this.getPref('import_autofill_form_data').value && 86 !(this.getPref('import_autofill_form_data').value &&
87 this.selected_.autofillFormData); 87 this.selected_.autofillFormData);
88 }, 88 },
89 89
90 /** 90 /**
91 * @param {!settings.ImportDataStatus} status 91 * @param {!settings.ImportDataStatus} status
92 * @return {boolean} Whether |status| is the current status. 92 * @return {boolean} Whether |status| is the current status.
93 * @private 93 * @private
94 */ 94 */
95 hasImportStatus_: function(status) { 95 hasImportStatus_: function(status) {
96 return this.importStatus_ == status; 96 return this.importStatus_ == status;
97 }, 97 },
98 98
99 /** @private */ 99 /** @private */
100 isImportFromFileSelected_: function() { 100 isImportFromFileSelected_: function() {
101 // The last entry in |browserProfiles_| always refers to dummy profile for 101 // The last entry in |browserProfiles_| always refers to dummy profile for
102 // importing from a bookmarks file. 102 // importing from a bookmarks file.
103 return this.selected_.index == this.browserProfiles_.length - 1; 103 return this.selected_.index == this.browserProfiles_.length - 1;
104 }, 104 },
105 105
106 /** 106 /**
107 * @return {string} 107 * @return {string}
108 * @private 108 * @private
109 */ 109 */
110 getActionButtonText_: function() { 110 getActionButtonText_: function() {
111 return this.i18n(this.isImportFromFileSelected_() ? 111 return this.i18n(
112 'importChooseFile' : 'importCommit'); 112 this.isImportFromFileSelected_() ? 'importChooseFile' : 'importCommit');
113 }, 113 },
114 114
115 /** @private */ 115 /** @private */
116 onBrowserProfileSelectionChange_: function() { 116 onBrowserProfileSelectionChange_: function() {
117 this.selected_ = this.browserProfiles_[this.$.browserSelect.selectedIndex]; 117 this.selected_ = this.browserProfiles_[this.$.browserSelect.selectedIndex];
118 }, 118 },
119 119
120 /** @private */ 120 /** @private */
121 onActionButtonTap_: function() { 121 onActionButtonTap_: function() {
122 if (this.isImportFromFileSelected_()) 122 if (this.isImportFromFileSelected_())
123 this.browserProxy_.importFromBookmarksFile(); 123 this.browserProxy_.importFromBookmarksFile();
124 else 124 else
125 this.browserProxy_.importData(this.$.browserSelect.selectedIndex); 125 this.browserProxy_.importData(this.$.browserSelect.selectedIndex);
126 }, 126 },
127 127
128 /** @private */ 128 /** @private */
129 closeDialog_: function() { 129 closeDialog_: function() {
130 this.$.dialog.close(); 130 this.$.dialog.close();
131 }, 131 },
132 132
133 /** 133 /**
134 * @return {boolean} Whether the import button should be disabled. 134 * @return {boolean} Whether the import button should be disabled.
135 * @private 135 * @private
136 */ 136 */
137 shouldDisableImport_: function() { 137 shouldDisableImport_: function() {
138 return this.hasImportStatus_(settings.ImportDataStatus.IN_PROGRESS) || 138 return this.hasImportStatus_(settings.ImportDataStatus.IN_PROGRESS) ||
139 this.noImportDataTypeSelected_; 139 this.noImportDataTypeSelected_;
140 }, 140 },
141 }); 141 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698