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

Side by Side Diff: extensions/renderer/resources/app_runtime_custom_bindings.js

Issue 354483004: Implement <appview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_skeleton
Patch Set: Added tests Created 6 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Custom binding for the chrome.app.runtime API. 5 // Custom binding for the chrome.app.runtime API.
6 6
7 var binding = require('binding').Binding.create('app.runtime'); 7 var binding = require('binding').Binding.create('app.runtime');
8 8
9 var AppViewInternal =
10 require('binding').Binding.create('appViewInternal').generate();
9 var eventBindings = require('event_bindings'); 11 var eventBindings = require('event_bindings');
10 var fileSystemHelpers = requireNative('file_system_natives'); 12 var fileSystemHelpers = requireNative('file_system_natives');
11 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem; 13 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem;
12 var appNatives = requireNative('app_runtime'); 14 var appNatives = requireNative('app_runtime');
13 var DeserializeString = appNatives.DeserializeString; 15 var DeserializeString = appNatives.DeserializeString;
14 var SerializeToString = appNatives.SerializeToString; 16 var SerializeToString = appNatives.SerializeToString;
15 var CreateBlob = appNatives.CreateBlob; 17 var CreateBlob = appNatives.CreateBlob;
16 var entryIdManager = require('entryIdManager'); 18 var entryIdManager = require('entryIdManager');
17 19
20 eventBindings.registerArgumentMassager('app.runtime.onAppEmbeddingRequest',
21 function(args, dispatch) {
22 var appEmbeddingRequest = args[0];
23 var id = appEmbeddingRequest.guestInstanceId;
24 delete appEmbeddingRequest.guestInstanceId;
25 appEmbeddingRequest.allow = function(url, api, schema) {
26 AppViewInternal.attachFrame(url, id);
27 };
28
29 appEmbeddingRequest.deny = function() {
30 AppViewInternal.denyRequest(id);
31 };
32
33 dispatch([appEmbeddingRequest]);
34 });
35
18 eventBindings.registerArgumentMassager('app.runtime.onLaunched', 36 eventBindings.registerArgumentMassager('app.runtime.onLaunched',
19 function(args, dispatch) { 37 function(args, dispatch) {
20 var launchData = args[0]; 38 var launchData = args[0];
21 if (launchData.items) { 39 if (launchData.items) {
22 // An onLaunched corresponding to file_handlers in the app's manifest. 40 // An onLaunched corresponding to file_handlers in the app's manifest.
23 var items = []; 41 var items = [];
24 var numItems = launchData.items.length; 42 var numItems = launchData.items.length;
25 var itemLoaded = function(err, item) { 43 var itemLoaded = function(err, item) {
26 if (err) { 44 if (err) {
27 console.error('Error getting fileEntry, code: ' + err.code); 45 console.error('Error getting fileEntry, code: ' + err.code);
(...skipping 19 matching lines...) Expand all
47 }); 65 });
48 }); 66 });
49 } else { 67 } else {
50 // Default case. This currently covers an onLaunched corresponding to 68 // Default case. This currently covers an onLaunched corresponding to
51 // url_handlers in the app's manifest. 69 // url_handlers in the app's manifest.
52 dispatch([launchData]); 70 dispatch([launchData]);
53 } 71 }
54 }); 72 });
55 73
56 exports.binding = binding.generate(); 74 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698