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

Side by Side Diff: chrome/browser/resources/settings/downloads_page/downloads_page.js

Issue 2713343003: MD Settings: Add "Auto Open" setting to Downloads page UI. (Closed)
Patch Set: fix string Created 3 years, 9 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 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:
11 * 11 *
12 * <iron-animated-pages> 12 * <iron-animated-pages>
13 * <settings-downloads-page prefs="{{prefs}}"> 13 * <settings-downloads-page prefs="{{prefs}}">
14 * </settings-downloads-page> 14 * </settings-downloads-page>
15 * ... other pages ... 15 * ... other pages ...
16 * </iron-animated-pages> 16 * </iron-animated-pages>
17 */ 17 */
18 Polymer({ 18 Polymer({
19 is: 'settings-downloads-page', 19 is: 'settings-downloads-page',
20 20
21 behaviors: [WebUIListenerBehavior],
22
21 properties: { 23 properties: {
22 /** 24 /**
23 * Preferences state. 25 * Preferences state.
24 */ 26 */
25 prefs: { 27 prefs: {
26 type: Object, 28 type: Object,
27 notify: true, 29 notify: true,
28 }, 30 },
29 31
30 /** 32 /**
31 * Dictionary defining page visibility. 33 * Dictionary defining page visibility.
32 * @type {!DownloadsPageVisibility} 34 * @type {!DownloadsPageVisibility}
33 */ 35 */
34 pageVisibility: Object, 36 pageVisibility: Object,
37
38 /** @private */
39 autoOpenDownloads_: {
40 type: Boolean,
41 value: false,
42 },
43 },
44
45 /** @private {?settings.DownloadsBrowserProxy} */
46 browserProxy_: null,
47
48 /** @override */
49 attached: function() {
50 this.browserProxy_ = settings.DownloadsBrowserProxyImpl.getInstance();
51
52 this.addWebUIListener('auto-open-downloads-changed', function(autoOpen) {
53 this.autoOpenDownloads_ = autoOpen;
54 }.bind(this));
55
56 this.browserProxy_.initializeDownloads();
35 }, 57 },
36 58
37 /** @private */ 59 /** @private */
38 selectDownloadLocation_: function() { 60 selectDownloadLocation_: function() {
39 chrome.send('selectDownloadLocation'); 61 this.browserProxy_.selectDownloadLocation();
40 }, 62 },
41 63
42 // <if expr="chromeos"> 64 // <if expr="chromeos">
43 /** 65 /**
44 * @param {string} path 66 * @param {string} path
45 * @return {string} The download location string that is suitable to display 67 * @return {string} The download location string that is suitable to display
46 * in the UI. 68 * in the UI.
47 * @private 69 * @private
48 */ 70 */
49 getDownloadLocation_: function(path) { 71 getDownloadLocation_: function(path) {
50 // Replace /special/drive-<hash>/root with "Google Drive" for remote files, 72 // Replace /special/drive-<hash>/root with "Google Drive" for remote files,
51 // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads with 73 // /home/chronos/user/Downloads or /home/chronos/u-<hash>/Downloads with
52 // "Downloads" for local paths, and '/' with ' \u203a ' (angled quote sign) 74 // "Downloads" for local paths, and '/' with ' \u203a ' (angled quote sign)
53 // everywhere. It is used only for display purpose. 75 // everywhere. It is used only for display purpose.
54 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); 76 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive');
55 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); 77 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, '');
56 path = path.replace(/\//g, ' \u203a '); 78 path = path.replace(/\//g, ' \u203a ');
57 return path; 79 return path;
58 }, 80 },
59 // </if> 81 // </if>
82
Dan Beam 2017/02/28 02:36:42 nit: @private
tommycli 2017/02/28 17:06:39 Done.
83 onClearAutoOpenFileTypesTap_: function() {
84 this.browserProxy_.resetAutoOpenFileTypes();
85 },
60 }); 86 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698