OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
7 * 'settings-downloads-page' is the settings page containing downloads | 7 * 'settings-downloads-page' is the settings page containing downloads |
8 * settings. | 8 * settings. |
9 * | 9 * |
10 * Example: | 10 * Example: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 }, | 42 }, |
43 }, | 43 }, |
44 | 44 |
45 /** @private {?settings.DownloadsBrowserProxy} */ | 45 /** @private {?settings.DownloadsBrowserProxy} */ |
46 browserProxy_: null, | 46 browserProxy_: null, |
47 | 47 |
48 /** @override */ | 48 /** @override */ |
49 attached: function() { | 49 attached: function() { |
50 this.browserProxy_ = settings.DownloadsBrowserProxyImpl.getInstance(); | 50 this.browserProxy_ = settings.DownloadsBrowserProxyImpl.getInstance(); |
51 | 51 |
52 this.addWebUIListener('auto-open-downloads-changed', function(autoOpen) { | 52 this.addWebUIListener('auto-open-downloads-changed', autoOpen => { |
53 this.autoOpenDownloads_ = autoOpen; | 53 this.autoOpenDownloads_ = autoOpen; |
54 }.bind(this)); | 54 }); |
55 | 55 |
56 this.browserProxy_.initializeDownloads(); | 56 this.browserProxy_.initializeDownloads(); |
57 }, | 57 }, |
58 | 58 |
59 /** @private */ | 59 /** @private */ |
60 selectDownloadLocation_: function() { | 60 selectDownloadLocation_: function() { |
61 listenOnce(this, 'transitionend', function() { | 61 listenOnce(this, 'transitionend', () => { |
62 this.browserProxy_.selectDownloadLocation(); | 62 this.browserProxy_.selectDownloadLocation(); |
63 }.bind(this)); | 63 }); |
64 }, | 64 }, |
65 | 65 |
66 // <if expr="chromeos"> | 66 // <if expr="chromeos"> |
67 /** | 67 /** |
68 * @param {string} path | 68 * @param {string} path |
69 * @return {string} The download location string that is suitable to display | 69 * @return {string} The download location string that is suitable to display |
70 * in the UI. | 70 * in the UI. |
71 * @private | 71 * @private |
72 */ | 72 */ |
73 getDownloadLocation_: function(path) { | 73 getDownloadLocation_: function(path) { |
74 // Replace /special/drive-<hash>/root with "Google Drive" for remote files, | 74 // Replace /special/drive-<hash>/root with "Google Drive" for remote files, |
75 // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads with | 75 // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads with |
76 // "Downloads" for local paths, and '/' with ' \u203a ' (angled quote sign) | 76 // "Downloads" for local paths, and '/' with ' \u203a ' (angled quote sign) |
77 // everywhere. It is used only for display purpose. | 77 // everywhere. It is used only for display purpose. |
78 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); | 78 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); |
79 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); | 79 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); |
80 path = path.replace(/\//g, ' \u203a '); | 80 path = path.replace(/\//g, ' \u203a '); |
81 return path; | 81 return path; |
82 }, | 82 }, |
83 // </if> | 83 // </if> |
84 | 84 |
85 /** @private */ | 85 /** @private */ |
86 onClearAutoOpenFileTypesTap_: function() { | 86 onClearAutoOpenFileTypesTap_: function() { |
87 this.browserProxy_.resetAutoOpenFileTypes(); | 87 this.browserProxy_.resetAutoOpenFileTypes(); |
88 }, | 88 }, |
89 }); | 89 }); |
OLD | NEW |