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

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

Issue 16622003: Better error message in app.window.current() when called from bg page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | 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 Binding = require('binding').Binding; 8 var Binding = require('binding').Binding;
9 var chrome = requireNative('chrome').GetChrome(); 9 var chrome = requireNative('chrome').GetChrome();
10 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 }); 67 });
68 if (!willCallback) { 68 if (!willCallback) {
69 callback(undefined); 69 callback(undefined);
70 } 70 }
71 } 71 }
72 }); 72 });
73 73
74 apiFunctions.setHandleRequest('current', function() { 74 apiFunctions.setHandleRequest('current', function() {
75 if (!currentAppWindow) { 75 if (!currentAppWindow) {
76 console.error('chrome.app.window.current() is null -- window not ' + 76 console.error('The JavaScript context calling ' +
77 'created with chrome.app.window.create()'); 77 'chrome.app.window.current() has no associated AppWindow.');
78 return null; 78 return null;
79 } 79 }
80 return currentAppWindow; 80 return currentAppWindow;
81 }); 81 });
82 82
83 // This is an internal function, but needs to be bound with setHandleRequest 83 // This is an internal function, but needs to be bound with setHandleRequest
84 // because it is called from a different JS context. 84 // because it is called from a different JS context.
85 apiFunctions.setHandleRequest('initializeAppWindow', function(params) { 85 apiFunctions.setHandleRequest('initializeAppWindow', function(params) {
86 var currentWindowInternal = 86 var currentWindowInternal =
87 Binding.create('app.currentWindowInternal').generate(); 87 Binding.create('app.currentWindowInternal').generate();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 function onAppWindowClosed() { 164 function onAppWindowClosed() {
165 if (!currentAppWindow) 165 if (!currentAppWindow)
166 return; 166 return;
167 currentAppWindow.onClosed.dispatch(); 167 currentAppWindow.onClosed.dispatch();
168 } 168 }
169 169
170 exports.binding = appWindow.generate(); 170 exports.binding = appWindow.generate();
171 exports.onAppWindowClosed = onAppWindowClosed; 171 exports.onAppWindowClosed = onAppWindowClosed;
172 exports.updateAppWindowProperties = updateAppWindowProperties; 172 exports.updateAppWindowProperties = updateAppWindowProperties;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698