Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/import_data_dialog.js |
| diff --git a/chrome/browser/resources/settings/people_page/import_data_dialog.js b/chrome/browser/resources/settings/people_page/import_data_dialog.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a90481beeddacde6d742ced2fd59621331f619e5 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/people_page/import_data_dialog.js |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview 'settings-import-data-dialog' is a component for importing |
| + * bookmarks and other data from other sources. |
| + */ |
| +Polymer({ |
| + is: 'settings-import-data-dialog', |
| + |
| + behaviors: [I18nBehavior, WebUIListenerBehavior], |
| + |
| + properties: { |
| + /** @private {!Array<!settings.BrowserProfile>} */ |
| + browserProfiles_: Array, |
| + |
| + /** @private {!settings.BrowserProfile} */ |
| + selected_: Object, |
|
Dan Beam
2016/11/14 22:06:51
can we change this from a set of booleans to just
dpapad
2016/11/14 22:19:30
My plan was to investigate the prefs involved in f
dpapad
2016/11/14 23:18:03
Done, I added this in this CL. Checkboxes are now
|
| + }, |
| + |
| + /** @private {?settings.ImportDataBrowserProxy} */ |
| + browserProxy_: null, |
| + |
| + /** @override */ |
| + attached: function() { |
| + this.browserProxy_ = settings.ImportDataBrowserProxyImpl.getInstance(); |
| + this.browserProxy_.initializeImportDialog().then(function(data) { |
| + this.browserProfiles_ = data; |
| + this.selected_ = this.browserProfiles_[0]; |
| + }.bind(this)); |
| + |
| + this.addWebUIListener('import-data-status-changed', function(e) { |
| + // TODO(dpapad): Handle events to show spinner or success message. |
| + }); |
| + |
| + this.$.dialog.showModal(); |
| + }, |
| + |
| + /** @private */ |
| + isImportFromFileSelected_: function() { |
| + // The last entry in |browserProfiles_| always refers to dummy profile for |
| + // importing from a bookmarks file. |
| + return this.selected_.index == this.browserProfiles_.length - 1; |
| + }, |
| + |
| + /** |
| + * @return {string} |
| + * @private |
| + */ |
| + getActionButtonText_: function() { |
| + return this.i18n(this.isImportFromFileSelected_() ? |
| + 'importChooseFile' : 'importCommit'); |
| + }, |
| + |
| + /** @private */ |
| + onChange_: function() { |
| + this.selected_ = this.browserProfiles_[this.$.browserSelect.selectedIndex]; |
| + }, |
| + |
| + /** @private */ |
| + onActionButtonTap_: function() { |
| + if (this.isImportFromFileSelected_()) { |
| + this.browserProxy_.importFromBookmarksFile(); |
| + } else { |
| + // TODO(dpapad): Implement this. |
| + } |
| + }, |
| + |
| + /** @private */ |
| + onCancelTap_: function() { |
| + this.$.dialog.close(); |
| + }, |
| +}); |