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

Side by Side Diff: chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.js

Issue 10067021: Postpone setting up file handler's file permissions if handler is running lazy background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.html ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 // The ID of the extension we want to talk to.
6 var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla";
7
8 function errorCallback(error) {
9 var msg = '';
10 if (!error.code) {
11 msg = error.message;
12 } else {
13 switch (error.code) {
14 case FileError.QUOTA_EXCEEDED_ERR:
15 msg = 'QUOTA_EXCEEDED_ERR';
16 break;
17 case FileError.NOT_FOUND_ERR:
18 msg = 'NOT_FOUND_ERR';
19 break;
20 case FileError.SECURITY_ERR:
21 msg = 'SECURITY_ERR';
22 break;
23 case FileError.INVALID_MODIFICATION_ERR:
24 msg = 'INVALID_MODIFICATION_ERR';
25 break;
26 case FileError.INVALID_STATE_ERR:
27 msg = 'INVALID_STATE_ERR';
28 break;
29 default:
30 msg = 'Unknown Error';
31 break;
32 };
33 }
34
35 chrome.extension.sendRequest(fileBrowserExtensionId,
36 {fileContent: null,
37 error: {message: "File handler error: " + msg}},
38 function(response) {});
39 };
40
41 function onGotEntryByUrl(entry) {
42 var reader = new FileReader();
43 reader.onloadend = function(e) {
44 // Send data back to the file browser extension
45 chrome.extension.sendRequest(
46 fileBrowserExtensionId,
47 {fileContent: reader.result, error: null},
48 function(response) {});
49 };
50 reader.onerror = function(e) {
51 errorCallback(reader.error);
52 };
53 entry.file(function(file) {
54 reader.readAsText(file);
55 },
56 errorCallback);
57 };
58
59 function readEntryByUrl(entryUrl) {
60 window.webkitResolveLocalFileSystemURL(entryUrl, onGotEntryByUrl,
61 errorCallback);
62 };
63
64 readEntryByUrl(localStorage.entryURL);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698