| OLD | NEW |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 browserProxy_: null, | 51 browserProxy_: null, |
| 52 | 52 |
| 53 /** @override */ | 53 /** @override */ |
| 54 attached: function() { | 54 attached: function() { |
| 55 this.browserProxy_ = settings.ImportDataBrowserProxyImpl.getInstance(); | 55 this.browserProxy_ = settings.ImportDataBrowserProxyImpl.getInstance(); |
| 56 this.browserProxy_.initializeImportDialog().then( | 56 this.browserProxy_.initializeImportDialog().then( |
| 57 /** @param {!Array<!settings.BrowserProfile>} data */ | 57 /** @param {!Array<!settings.BrowserProfile>} data */ |
| 58 function(data) { | 58 function(data) { |
| 59 this.browserProfiles_ = data; | 59 this.browserProfiles_ = data; |
| 60 this.selected_ = this.browserProfiles_[0]; | 60 this.selected_ = this.browserProfiles_[0]; |
| 61 |
| 62 // Show the dialog only after the browser profiles data is populated |
| 63 // to avoid UI flicker. |
| 64 this.$.dialog.showModal(); |
| 61 }.bind(this)); | 65 }.bind(this)); |
| 62 | 66 |
| 63 this.addWebUIListener( | 67 this.addWebUIListener( |
| 64 'import-data-status-changed', | 68 'import-data-status-changed', |
| 65 /** @param {settings.ImportDataStatus} importStatus */ | 69 /** @param {settings.ImportDataStatus} importStatus */ |
| 66 function(importStatus) { | 70 function(importStatus) { |
| 67 this.importStatus_ = importStatus; | 71 this.importStatus_ = importStatus; |
| 68 if (this.hasImportStatus_(settings.ImportDataStatus.FAILED)) | 72 if (this.hasImportStatus_(settings.ImportDataStatus.FAILED)) |
| 69 this.closeDialog_(); | 73 this.closeDialog_(); |
| 70 }.bind(this)); | 74 }.bind(this)); |
| 71 | |
| 72 this.$.dialog.showModal(); | |
| 73 }, | 75 }, |
| 74 | 76 |
| 75 /** @private */ | 77 /** @private */ |
| 76 prefsChanged_() { | 78 prefsChanged_() { |
| 77 this.noImportDataTypeSelected_ = | 79 this.noImportDataTypeSelected_ = |
| 78 !(this.getPref('import_history').value && this.selected_.history) && | 80 !(this.getPref('import_history').value && this.selected_.history) && |
| 79 !(this.getPref('import_bookmarks').value && this.selected_.favorites) && | 81 !(this.getPref('import_bookmarks').value && this.selected_.favorites) && |
| 80 !(this.getPref('import_saved_passwords').value && | 82 !(this.getPref('import_saved_passwords').value && |
| 81 this.selected_.passwords) && | 83 this.selected_.passwords) && |
| 82 !(this.getPref('import_search_engine').value && | 84 !(this.getPref('import_search_engine').value && |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 132 |
| 131 /** | 133 /** |
| 132 * @return {boolean} Whether the import button should be disabled. | 134 * @return {boolean} Whether the import button should be disabled. |
| 133 * @private | 135 * @private |
| 134 */ | 136 */ |
| 135 shouldDisableImport_: function() { | 137 shouldDisableImport_: function() { |
| 136 return this.hasImportStatus_(settings.ImportDataStatus.IN_PROGRESS) || | 138 return this.hasImportStatus_(settings.ImportDataStatus.IN_PROGRESS) || |
| 137 this.noImportDataTypeSelected_; | 139 this.noImportDataTypeSelected_; |
| 138 }, | 140 }, |
| 139 }); | 141 }); |
| OLD | NEW |