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

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

Issue 1107163002: Sandbox windows not provided to chrome.app.window.create. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/docs/templates/articles/app_external.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
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 // Custom binding for the app_window API. 5 // Custom binding for the app_window API.
6 6
7 var appWindowNatives = requireNative('app_window_natives'); 7 var appWindowNatives = requireNative('app_window_natives');
8 var runtimeNatives = requireNative('runtime'); 8 var runtimeNatives = requireNative('runtime');
9 var Binding = require('binding').Binding; 9 var Binding = require('binding').Binding;
10 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 if (windowParams.existingWindow) { 134 if (windowParams.existingWindow) {
135 // Not creating a new window, but activating an existing one, so trigger 135 // Not creating a new window, but activating an existing one, so trigger
136 // callback with existing window and don't do anything else. 136 // callback with existing window and don't do anything else.
137 if (callback) 137 if (callback)
138 callback(view.chrome.app.window.current()); 138 callback(view.chrome.app.window.current());
139 return; 139 return;
140 } 140 }
141 141
142 // Initialize appWindowData in the newly created JS context 142 // Initialize appWindowData in the newly created JS context
143 view.chrome.app.window.initializeAppWindow(windowParams); 143 if (view.chrome.app) {
144 view.chrome.app.window.initializeAppWindow(windowParams);
145 } else {
146 var sandbox_window_message = 'Creating sandboxed window, it doesn\'t ' +
147 'have access to the chrome.app API.';
148 if (callback) {
149 sandbox_window_message = sandbox_window_message +
150 ' The chrome.app.window.create callback will be called, but ' +
151 'there will be no object provided for the sandboxed window.';
152 }
153 console.warn(sandbox_window_message);
154 }
144 155
145 if (callback) { 156 if (callback) {
146 if (!view) { 157 if (!view || !view.chrome.app /* sandboxed window */) {
147 callback(undefined); 158 callback(undefined);
148 return; 159 return;
149 } 160 }
150 161
151 var willCallback = 162 var willCallback =
152 renderViewObserverNatives.OnDocumentElementCreated( 163 renderViewObserverNatives.OnDocumentElementCreated(
153 windowParams.viewId, 164 windowParams.viewId,
154 function(success) { 165 function(success) {
155 if (success) { 166 if (success) {
156 callback(view.chrome.app.window.current()); 167 callback(view.chrome.app.window.current());
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 constraints[key] = 0; 401 constraints[key] = 0;
391 }); 402 });
392 403
393 currentWindowInternal.setSizeConstraints(boundsType, constraints); 404 currentWindowInternal.setSizeConstraints(boundsType, constraints);
394 } 405 }
395 406
396 exports.binding = appWindow.generate(); 407 exports.binding = appWindow.generate();
397 exports.onAppWindowClosed = onAppWindowClosed; 408 exports.onAppWindowClosed = onAppWindowClosed;
398 exports.updateAppWindowProperties = updateAppWindowProperties; 409 exports.updateAppWindowProperties = updateAppWindowProperties;
399 exports.appWindowShownForTests = onAppWindowShownForTests; 410 exports.appWindowShownForTests = onAppWindowShownForTests;
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/templates/articles/app_external.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698