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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview 'settings-import-data-dialog' is a component for importing
7 * bookmarks and other data from other sources.
8 */
9 Polymer({
10 is: 'settings-import-data-dialog',
11
12 behaviors: [I18nBehavior, WebUIListenerBehavior],
13
14 properties: {
15 /** @private {!Array<!settings.BrowserProfile>} */
16 browserProfiles_: Array,
17
18 /** @private {!settings.BrowserProfile} */
19 selected_: Object,
20
21 prefs: Object,
22 },
23
24 /** @private {?settings.ImportDataBrowserProxy} */
25 browserProxy_: null,
26
27 /** @override */
28 attached: function() {
29 this.browserProxy_ = settings.ImportDataBrowserProxyImpl.getInstance();
30 this.browserProxy_.initializeImportDialog().then(function(data) {
31 this.browserProfiles_ = data;
32 this.selected_ = this.browserProfiles_[0];
33 }.bind(this));
34
35 this.addWebUIListener('import-data-status-changed', function(e) {
36 // TODO(dpapad): Handle events to show spinner or success message.
37 });
38
39 this.$.dialog.showModal();
40 },
41
42 /** @private */
43 isImportFromFileSelected_: function() {
44 // The last entry in |browserProfiles_| always refers to dummy profile for
45 // importing from a bookmarks file.
46 return this.selected_.index == this.browserProfiles_.length - 1;
47 },
48
49 /**
50 * @return {string}
51 * @private
52 */
53 getActionButtonText_: function() {
54 return this.i18n(this.isImportFromFileSelected_() ?
55 'importChooseFile' : 'importCommit');
56 },
57
58 /** @private */
59 onChange_: function() {
60 this.selected_ = this.browserProfiles_[this.$.browserSelect.selectedIndex];
61 },
62
63 /** @private */
64 onActionButtonTap_: function() {
65 if (this.isImportFromFileSelected_()) {
66 this.browserProxy_.importFromBookmarksFile();
67 } else {
68 // TODO(dpapad): Implement this.
69 }
70 },
71
72 /** @private */
73 onCancelTap_: function() {
74 this.$.dialog.close();
75 },
76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698