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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.js
diff --git a/chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.js b/chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.js
new file mode 100644
index 0000000000000000000000000000000000000000..82a59425f55ca3ddc6d6058bfa23d9e1a7420412
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/filesystem_handler_lazy_background/tab.js
@@ -0,0 +1,64 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// The ID of the extension we want to talk to.
+var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla";
+
+function errorCallback(error) {
+ var msg = '';
+ if (!error.code) {
+ msg = error.message;
+ } else {
+ switch (error.code) {
+ case FileError.QUOTA_EXCEEDED_ERR:
+ msg = 'QUOTA_EXCEEDED_ERR';
+ break;
+ case FileError.NOT_FOUND_ERR:
+ msg = 'NOT_FOUND_ERR';
+ break;
+ case FileError.SECURITY_ERR:
+ msg = 'SECURITY_ERR';
+ break;
+ case FileError.INVALID_MODIFICATION_ERR:
+ msg = 'INVALID_MODIFICATION_ERR';
+ break;
+ case FileError.INVALID_STATE_ERR:
+ msg = 'INVALID_STATE_ERR';
+ break;
+ default:
+ msg = 'Unknown Error';
+ break;
+ };
+ }
+
+ chrome.extension.sendRequest(fileBrowserExtensionId,
+ {fileContent: null,
+ error: {message: "File handler error: " + msg}},
+ function(response) {});
+};
+
+function onGotEntryByUrl(entry) {
+ var reader = new FileReader();
+ reader.onloadend = function(e) {
+ // Send data back to the file browser extension
+ chrome.extension.sendRequest(
+ fileBrowserExtensionId,
+ {fileContent: reader.result, error: null},
+ function(response) {});
+ };
+ reader.onerror = function(e) {
+ errorCallback(reader.error);
+ };
+ entry.file(function(file) {
+ reader.readAsText(file);
+ },
+ errorCallback);
+};
+
+function readEntryByUrl(entryUrl) {
+ window.webkitResolveLocalFileSystemURL(entryUrl, onGotEntryByUrl,
+ errorCallback);
+};
+
+readEntryByUrl(localStorage.entryURL);
« 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