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

Unified Diff: chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js

Issue 1138503005: Fix examples for File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing callbacks. Created 5 years, 7 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 | « no previous file | chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/example1.fake » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js
diff --git a/chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js b/chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js
index 09458cdf25268712704560fb4d02955f63decfa3..231ddcccce0b806049831b9a5c691304a2379b70 100644
--- a/chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js
+++ b/chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/background.js
@@ -41,12 +41,13 @@ function onUnmountRequested(options, onSuccess, onError) {
chrome.fileSystemProvider.unmount(
{fileSystemId: options.fileSystemId},
function() {
+ if (chrome.runtime.lastError) {
+ onError(chrome.runtime.lastError.message);
+ return;
+ }
delete volumes[options.fileSystemId];
saveState(); // Remove volume from local storage state.
onSuccess();
- },
- function() {
- onError('FAILED');
});
};
@@ -202,8 +203,14 @@ chrome.app.runtime.onLaunched.addListener(function(event) {
volumes[displayPath] = new Volume(item.entry, metadata);
chrome.fileSystemProvider.mount(
{fileSystemId: displayPath, displayName: item.entry.name},
- function() { saveState(); },
- function() { console.error('Failed to mount.'); });
+ function() {
+ if (chrome.runtime.lastError) {
+ console.error('Failed to mount because of: ' +
+ chrome.runtime.lastError.message);
+ return;
+ };
+ saveState();
+ });
});
},
function(error) {
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/api/fileSystemProvider/archive/example1.fake » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698