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

Side by Side Diff: chrome/browser/resources/settings/people_page/import_data_browser_proxy.js

Issue 2954863003: MD Settings: Convert all browser proxies to use ES6 class syntax. (Closed)
Patch Set: Remove @constructor annotations. Created 3 years, 5 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 A helper object used from the the Import Data dialog to allow 6 * @fileoverview A helper object used from the the Import Data dialog to allow
7 * users to import data (like bookmarks) from other web browsers. 7 * users to import data (like bookmarks) from other web browsers.
8 */ 8 */
9 cr.exportPath('settings'); 9 cr.exportPath('settings');
10 10
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 settings.ImportDataStatus = { 30 settings.ImportDataStatus = {
31 INITIAL: 'initial', 31 INITIAL: 'initial',
32 IN_PROGRESS: 'inProgress', 32 IN_PROGRESS: 'inProgress',
33 SUCCEEDED: 'succeeded', 33 SUCCEEDED: 'succeeded',
34 FAILED: 'failed', 34 FAILED: 'failed',
35 }; 35 };
36 36
37 cr.define('settings', function() { 37 cr.define('settings', function() {
38 /** @interface */ 38 /** @interface */
39 function ImportDataBrowserProxy() {} 39 class ImportDataBrowserProxy {
40
41 ImportDataBrowserProxy.prototype = {
42 /** 40 /**
43 * Returns the source profiles available for importing from other browsers. 41 * Returns the source profiles available for importing from other browsers.
44 * @return {!Promise<!Array<!settings.BrowserProfile>>} 42 * @return {!Promise<!Array<!settings.BrowserProfile>>}
45 */ 43 */
46 initializeImportDialog: function() {}, 44 initializeImportDialog() {}
47 45
48 /** 46 /**
49 * Starts importing data for the specificed source browser profile. The C++ 47 * Starts importing data for the specificed source browser profile. The C++
50 * responds with the 'import-data-status-changed' WebUIListener event. 48 * responds with the 'import-data-status-changed' WebUIListener event.
51 * @param {number} sourceBrowserProfileIndex 49 * @param {number} sourceBrowserProfileIndex
52 */ 50 */
53 importData: function(sourceBrowserProfileIndex) {}, 51 importData(sourceBrowserProfileIndex) {}
54 52
55 /** 53 /**
56 * Prompts the user to choose a bookmarks file to import bookmarks from. 54 * Prompts the user to choose a bookmarks file to import bookmarks from.
57 */ 55 */
58 importFromBookmarksFile: function() {}, 56 importFromBookmarksFile() {}
59 }; 57 }
60 58
61 /** 59 /**
62 * @constructor
63 * @implements {settings.ImportDataBrowserProxy} 60 * @implements {settings.ImportDataBrowserProxy}
64 */ 61 */
65 function ImportDataBrowserProxyImpl() {} 62 class ImportDataBrowserProxyImpl {
63 /** @override */
64 initializeImportDialog() {
65 return cr.sendWithPromise('initializeImportDialog');
66 }
67
68 /** @override */
69 importData(sourceBrowserProfileIndex) {
70 chrome.send('importData', [sourceBrowserProfileIndex]);
71 }
72
73 /** @override */
74 importFromBookmarksFile() {
75 chrome.send('importFromBookmarksFile');
76 }
77 }
78
66 // The singleton instance_ is replaced with a test version of this wrapper 79 // The singleton instance_ is replaced with a test version of this wrapper
67 // during testing. 80 // during testing.
68 cr.addSingletonGetter(ImportDataBrowserProxyImpl); 81 cr.addSingletonGetter(ImportDataBrowserProxyImpl);
69 82
70 ImportDataBrowserProxyImpl.prototype = {
71 /** @override */
72 initializeImportDialog: function() {
73 return cr.sendWithPromise('initializeImportDialog');
74 },
75
76 /** @override */
77 importData: function(sourceBrowserProfileIndex) {
78 chrome.send('importData', [sourceBrowserProfileIndex]);
79 },
80
81 /** @override */
82 importFromBookmarksFile: function() {
83 chrome.send('importFromBookmarksFile');
84 },
85 };
86
87 return { 83 return {
88 ImportDataBrowserProxy: ImportDataBrowserProxy, 84 ImportDataBrowserProxy: ImportDataBrowserProxy,
89 ImportDataBrowserProxyImpl: ImportDataBrowserProxyImpl, 85 ImportDataBrowserProxyImpl: ImportDataBrowserProxyImpl,
90 }; 86 };
91 }); 87 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698