| 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 20 matching lines...) Expand all Loading... |
| 31 * Dictionary defining page visibility. | 31 * Dictionary defining page visibility. |
| 32 * @type {!DownloadsPageVisibility} | 32 * @type {!DownloadsPageVisibility} |
| 33 */ | 33 */ |
| 34 pageVisibility: Object, | 34 pageVisibility: Object, |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 /** @private */ | 37 /** @private */ |
| 38 selectDownloadLocation_: function() { | 38 selectDownloadLocation_: function() { |
| 39 chrome.send('selectDownloadLocation'); | 39 chrome.send('selectDownloadLocation'); |
| 40 }, | 40 }, |
| 41 |
| 42 /** |
| 43 * @param {string} path |
| 44 * @return {string} The download location string that is suitable to display |
| 45 * in the UI. |
| 46 * @private |
| 47 */ |
| 48 getDownloadLocation_: function(path) { |
| 49 // Replace /special/drive-<hash>/root with "Google Drive" for remote files, |
| 50 // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads with |
| 51 // "Downloads" for local paths, and '/' with ' \u203a ' (angled quote sign) |
| 52 // everywhere. It is used only for display purpose. |
| 53 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); |
| 54 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); |
| 55 path = path.replace(/\//g, ' \u203a '); |
| 56 return path; |
| 57 }, |
| 41 }); | 58 }); |
| OLD | NEW |