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

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

Issue 16975007: Run shim's watchForTag on document.DOMContentLoaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from kalman. 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
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 renderViewObserverNatives = requireNative('renderViewObserverNatives');
8 var Binding = require('binding').Binding; 9 var Binding = require('binding').Binding;
9 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
10 var forEach = require('utils').forEach; 11 var forEach = require('utils').forEach;
11 var sendRequest = require('sendRequest').sendRequest; 12 var sendRequest = require('sendRequest').sendRequest;
12 13
13 var appWindowData = null; 14 var appWindowData = null;
14 var currentAppWindow = null; 15 var currentAppWindow = null;
15 16
16 var appWindow = Binding.create('app.window'); 17 var appWindow = Binding.create('app.window');
17 appWindow.registerCustomHook(function(bindingsAPI) { 18 appWindow.registerCustomHook(function(bindingsAPI) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 view.chrome.app.window.initializeAppWindow(windowParams); 50 view.chrome.app.window.initializeAppWindow(windowParams);
50 51
51 var callback = request.callback; 52 var callback = request.callback;
52 if (callback) { 53 if (callback) {
53 delete request.callback; 54 delete request.callback;
54 if (!view) { 55 if (!view) {
55 callback(undefined); 56 callback(undefined);
56 return; 57 return;
57 } 58 }
58 59
59 var willCallback = appWindowNatives.OnContextReady(windowParams.viewId, 60 var willCallback =
60 function(success) { 61 renderViewObserverNatives.OnDocumentCreated(windowParams.viewId,
61 if (success) { 62 function(success) {
62 callback(view.chrome.app.window.current()); 63 if (success) {
63 } else { 64 callback(view.chrome.app.window.current());
64 callback(undefined); 65 } else {
65 } 66 callback(undefined);
66 }); 67 }
68 });
67 if (!willCallback) { 69 if (!willCallback) {
68 callback(undefined); 70 callback(undefined);
69 } 71 }
70 } 72 }
71 }); 73 });
72 74
73 apiFunctions.setHandleRequest('current', function() { 75 apiFunctions.setHandleRequest('current', function() {
74 if (!currentAppWindow) { 76 if (!currentAppWindow) {
75 console.error('chrome.app.window.current() is null -- window not ' + 77 console.error('chrome.app.window.current() is null -- window not ' +
76 'created with chrome.app.window.create()'); 78 'created with chrome.app.window.create()');
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 function onAppWindowClosed() { 165 function onAppWindowClosed() {
164 if (!currentAppWindow) 166 if (!currentAppWindow)
165 return; 167 return;
166 currentAppWindow.onClosed.dispatch(); 168 currentAppWindow.onClosed.dispatch();
167 } 169 }
168 170
169 exports.binding = appWindow.generate(); 171 exports.binding = appWindow.generate();
170 exports.onAppWindowClosed = onAppWindowClosed; 172 exports.onAppWindowClosed = onAppWindowClosed;
171 exports.updateAppWindowProperties = updateAppWindowProperties; 173 exports.updateAppWindowProperties = updateAppWindowProperties;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698