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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_tasks.js

Issue 10828092: [File Manager] Better message when trying to open unsupported files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * This object encapsulates everything related to tasks execution. 6 * This object encapsulates everything related to tasks execution.
7 * @param {FileManager} fileManager FileManager instance. 7 * @param {FileManager} fileManager FileManager instance.
8 * @param {Array.<string>} urls List of file urls. 8 * @param {Array.<string>} urls List of file urls.
9 */ 9 */
10 function FileTasks(fileManager, urls) { 10 function FileTasks(fileManager, urls) {
11 this.fileManager_ = fileManager; 11 this.fileManager_ = fileManager;
12 this.urls_ = urls; 12 this.urls_ = urls;
13 this.tasks_ = null; 13 this.tasks_ = null;
14 this.defaultTask_ = null; 14 this.defaultTask_ = null;
15 15
16 /** 16 /**
17 * List of invocations to be called once tasks are available. 17 * List of invocations to be called once tasks are available.
18 */ 18 */
19 this.pendingInvocations_ = []; 19 this.pendingInvocations_ = [];
20 20
21 if (urls.length > 0) 21 if (urls.length > 0)
22 chrome.fileBrowserPrivate.getFileTasks(urls, this.onTasks_.bind(this)); 22 chrome.fileBrowserPrivate.getFileTasks(urls, this.onTasks_.bind(this));
23 } 23 }
24 24
25 /** 25 /**
26 * Location of the Chrome Web Store.
27 */
28 FileTasks.CHROME_WEB_STORE_URL = 'https://chrome.google.com/webstore';
29
30 /**
26 * Location of the FAQ about the file actions. 31 * Location of the FAQ about the file actions.
27 */ 32 */
28 FileTasks.NO_ACTION_FOR_FILE_URL = 'http://support.google.com/chromeos/bin/' + 33 FileTasks.NO_ACTION_FOR_FILE_URL = 'http://support.google.com/chromeos/bin/' +
29 'answer.py?answer=1700055&topic=29026&ctx=topic'; 34 'answer.py?answer=1700055&topic=29026&ctx=topic';
30 35
31 /** 36 /**
32 * Callback when tasks found. 37 * Callback when tasks found.
33 * @param {Array.<Object>} tasks The tasks. 38 * @param {Array.<Object>} tasks The tasks.
34 * @private 39 * @private
35 */ 40 */
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // We don't have tasks, so try to show a file in a browser tab. 118 // We don't have tasks, so try to show a file in a browser tab.
114 // We only do that for single selection to avoid confusion. 119 // We only do that for single selection to avoid confusion.
115 if (this.urls_.length == 1) { 120 if (this.urls_.length == 1) {
116 var callback = function(success) { 121 var callback = function(success) {
117 if (!success) { 122 if (!success) {
118 var filename = decodeURIComponent(this.urls_[0]); 123 var filename = decodeURIComponent(this.urls_[0]);
119 if (filename.indexOf('/') != -1) 124 if (filename.indexOf('/') != -1)
120 filename = filename.substr(filename.lastIndexOf('/') + 1); 125 filename = filename.substr(filename.lastIndexOf('/') + 1);
121 126
122 var text = loadTimeData.getStringF('NO_ACTION_FOR_FILE', 127 var text = loadTimeData.getStringF('NO_ACTION_FOR_FILE',
128 FileTasks.CHROME_WEB_STORE_URL,
123 FileTasks.NO_ACTION_FOR_FILE_URL); 129 FileTasks.NO_ACTION_FOR_FILE_URL);
124 this.fileManager_.alert.showHtml(filename, text, function() {}); 130 this.fileManager_.alert.showHtml(filename, text, function() {});
125 } 131 }
126 }.bind(this); 132 }.bind(this);
127 133
128 this.checkAvailability_(function() { 134 this.checkAvailability_(function() {
129 chrome.fileBrowserPrivate.viewFiles(this.urls_, 'default', callback); 135 chrome.fileBrowserPrivate.viewFiles(this.urls_, 'default', callback);
130 }.bind(this)); 136 }.bind(this));
131 } 137 }
132 138
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return this; 501 return this;
496 }; 502 };
497 }; 503 };
498 504
499 FileTasks.decorate('display'); 505 FileTasks.decorate('display');
500 FileTasks.decorate('updateMenuItem'); 506 FileTasks.decorate('updateMenuItem');
501 FileTasks.decorate('execute'); 507 FileTasks.decorate('execute');
502 FileTasks.decorate('executeDefault'); 508 FileTasks.decorate('executeDefault');
503 FileTasks.decorate('getExternals'); 509 FileTasks.decorate('getExternals');
504 510
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698