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

Unified Diff: chrome/browser/resources/settings/people_page/import_data_dialog.js

Issue 2500653002: MD Settings: Add import data dialog. (Closed)
Patch Set: Fix bad merge Created 4 years, 1 month 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/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..d58a5c568987f8ba53dfb45cbb2528dd3e2e0de3
--- /dev/null
+++ b/chrome/browser/resources/settings/people_page/import_data_dialog.js
@@ -0,0 +1,76 @@
+// 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,
+
+ prefs: Object,
+ },
+
+ /** @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();
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698