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/file_manager/js/mock_chrome.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: Rebase 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
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_tasks.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function MockEventSource() { 5 function MockEventSource() {
6 this.listeners_ = []; 6 this.listeners_ = [];
7 } 7 }
8 8
9 /** 9 /**
10 * Add a listener. 10 * Add a listener.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 */ 60 */
61 requestLocalFileSystem: function(callback) { 61 requestLocalFileSystem: function(callback) {
62 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, 62 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024,
63 callback, 63 callback,
64 util.ferr('Error requesting filesystem')); 64 util.ferr('Error requesting filesystem'));
65 }, 65 },
66 66
67 /** 67 /**
68 * View multiple files. 68 * View multiple files.
69 */ 69 */
70 viewFiles: function(selectedFiles) { 70 viewFiles: function(urls, actionId, callback) {
71 console.log('viewFiles called: ' + selectedFiles.length + 71 var success = true;
72 ' files selected'); 72 for (var i = 0; i != urls.length; i++) {
73 for (var i = 0; i != selectedFiles.length; i++) { 73 var url = urls[i];
74 window.open(selectedFiles[i]); 74 if (!url.match(/\.(pdf|txt)$/i)) {
75 success = false;
76 break;
77 }
78 window.open(url);
75 } 79 }
80 callback(success);
76 }, 81 },
77 82
78 /** 83 /**
79 * Select multiple files. 84 * Select multiple files.
80 */ 85 */
81 selectFiles: function(selectedFiles) { 86 selectFiles: function(selectedFiles) {
82 console.log('selectFiles called: ' + selectedFiles.length + 87 console.log('selectFiles called: ' + selectedFiles.length +
83 ' files selected'); 88 ' files selected');
84 }, 89 },
85 90
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 PASTE_ITEMS_REMAINING: 'Transferring $1 items', 586 PASTE_ITEMS_REMAINING: 'Transferring $1 items',
582 PASTE_CANCELLED: 'Transfer cancelled.', 587 PASTE_CANCELLED: 'Transfer cancelled.',
583 PASTE_TARGET_EXISTS_ERROR: 'Transfer failed, item exists: "$1"', 588 PASTE_TARGET_EXISTS_ERROR: 'Transfer failed, item exists: "$1"',
584 PASTE_FILESYSTEM_ERROR: 'Transfer failed. $1', 589 PASTE_FILESYSTEM_ERROR: 'Transfer failed. $1',
585 PASTE_UNEXPECTED_ERROR: 'Transfer failed, unexpected error: $1', 590 PASTE_UNEXPECTED_ERROR: 'Transfer failed, unexpected error: $1',
586 591
587 CANCEL_LABEL: 'Cancel', 592 CANCEL_LABEL: 'Cancel',
588 OPEN_LABEL: 'Open', 593 OPEN_LABEL: 'Open',
589 SAVE_LABEL: 'Save', 594 SAVE_LABEL: 'Save',
590 OK_LABEL: 'OK', 595 OK_LABEL: 'OK',
591 NO_ACTION_FOR_FILE: "To view this file, convert it to a format that's view able on the web. <a target='_blank' href='$1'>Learn More.</a>", 596 NO_ACTION_FOR_FILE: 'This file type is not supported. Please visit the ' +
597 '<a target=\'_blank\' href=\'$1\'>Chrome Web Store</a>' +
598 ' to find an app that can open this type of file.' +
599 ' <a target=\'_blank\' href=\'$2\'>Learn More.</a>',
592 600
593 DEFAULT_NEW_FOLDER_NAME: 'New Folder', 601 DEFAULT_NEW_FOLDER_NAME: 'New Folder',
594 MORE_FILES: 'Show all files', 602 MORE_FILES: 'Show all files',
595 603
596 SELECT_FOLDER_TITLE: 'Select a folder to open', 604 SELECT_FOLDER_TITLE: 'Select a folder to open',
597 SELECT_OPEN_FILE_TITLE: 'Select a file to open', 605 SELECT_OPEN_FILE_TITLE: 'Select a file to open',
598 SELECT_OPEN_MULTI_FILE_TITLE: 'Select one or more files', 606 SELECT_OPEN_MULTI_FILE_TITLE: 'Select one or more files',
599 SELECT_SAVEAS_FILE_TITLE: 'Save file as', 607 SELECT_SAVEAS_FILE_TITLE: 'Save file as',
600 608
601 COMPUTING_SELECTION: 'Computing selection...', 609 COMPUTING_SELECTION: 'Computing selection...',
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 compare: function(a, b) { 825 compare: function(a, b) {
818 if (a > b) return 1; 826 if (a > b) return 1;
819 if (a < b) return -1; 827 if (a < b) return -1;
820 return 0; 828 return 0;
821 } 829 }
822 }; 830 };
823 }; 831 };
824 832
825 return v8Intl; 833 return v8Intl;
826 }()); 834 }());
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_tasks.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698