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

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

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 // The ID of the extension we want to talk to. 5 // The ID of the extension we want to talk to.
6 var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla"; 6 var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla";
7 7
8 function errorCallback(error) { 8 function errorCallback(error) {
9 var msg = ''; 9 var msg = '';
10 if (!error.code) { 10 if (!error.code) {
(...skipping 14 matching lines...) Expand all
25 break; 25 break;
26 case FileError.INVALID_STATE_ERR: 26 case FileError.INVALID_STATE_ERR:
27 msg = 'INVALID_STATE_ERR'; 27 msg = 'INVALID_STATE_ERR';
28 break; 28 break;
29 default: 29 default:
30 msg = 'Unknown Error'; 30 msg = 'Unknown Error';
31 break; 31 break;
32 }; 32 };
33 } 33 }
34 34
35 chrome.extension.sendMessage(fileBrowserExtensionId, 35 chrome.runtime.sendMessage(fileBrowserExtensionId,
36 {fileContent: null, 36 {fileContent: null,
37 error: {message: "File handler error: " + msg}}, 37 error: {message: "File handler error: " + msg}},
38 function(response) {}); 38 function(response) {});
39 }; 39 };
40 40
41 function onGotEntryByUrl(entry) { 41 function onGotEntryByUrl(entry) {
42 var reader = new FileReader(); 42 var reader = new FileReader();
43 reader.onloadend = function(e) { 43 reader.onloadend = function(e) {
44 // Send data back to the file browser extension 44 // Send data back to the file browser extension
45 chrome.extension.sendMessage( 45 chrome.runtime.sendMessage(
46 fileBrowserExtensionId, 46 fileBrowserExtensionId,
47 {fileContent: reader.result, error: null}, 47 {fileContent: reader.result, error: null},
48 function(response) {}); 48 function(response) {});
49 }; 49 };
50 reader.onerror = function(e) { 50 reader.onerror = function(e) {
51 errorCallback(reader.error); 51 errorCallback(reader.error);
52 }; 52 };
53 entry.file(function(file) { 53 entry.file(function(file) {
54 reader.readAsText(file); 54 reader.readAsText(file);
55 }, 55 },
56 errorCallback); 56 errorCallback);
57 }; 57 };
58 58
59 function readEntryByUrl(entryUrl) { 59 function readEntryByUrl(entryUrl) {
60 window.webkitResolveLocalFileSystemURL(entryUrl, onGotEntryByUrl, 60 window.webkitResolveLocalFileSystemURL(entryUrl, onGotEntryByUrl,
61 errorCallback); 61 errorCallback);
62 }; 62 };
63 63
64 readEntryByUrl(localStorage.entryURL); 64 readEntryByUrl(localStorage.entryURL);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698