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

Side by Side Diff: chrome/renderer/resources/event_bindings.js

Issue 7727004: Initialize content scripts the same way extension scripts are. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 var chrome = chrome || {}; 5 var chrome = chrome || {};
6 (function () { 6 (function () {
7 native function GetChromeHidden(); 7 native function GetChromeHidden();
8 native function AttachEvent(eventName); 8 native function AttachEvent(eventName);
9 native function DetachEvent(eventName); 9 native function DetachEvent(eventName);
10 native function GetExternalFileEntry(fileDefinition); 10 native function GetExternalFileEntry(fileDefinition);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 this.validate_ = []; 225 this.validate_ = [];
226 this.detach_(); 226 this.detach_();
227 }; 227 };
228 228
229 // Special load events: we don't use the DOM unload because that slows 229 // Special load events: we don't use the DOM unload because that slows
230 // down tab shutdown. On the other hand, onUnload might not always fire, 230 // down tab shutdown. On the other hand, onUnload might not always fire,
231 // since Chrome will terminate renderers on shutdown (SuddenTermination). 231 // since Chrome will terminate renderers on shutdown (SuddenTermination).
232 chromeHidden.onLoad = new chrome.Event(); 232 chromeHidden.onLoad = new chrome.Event();
233 chromeHidden.onUnload = new chrome.Event(); 233 chromeHidden.onUnload = new chrome.Event();
234 234
235 chromeHidden.dispatchOnLoad = function(extensionId) { 235 chromeHidden.dispatchOnLoad = function(extensionId, isExtensionProcess,
236 chromeHidden.onLoad.dispatch(extensionId); 236 isIncognitoContext) {
237 chromeHidden.onLoad.dispatch(extensionId, isExtensionProcess,
238 isIncognitoContext);
237 }; 239 };
238 240
239 chromeHidden.dispatchOnUnload = function() { 241 chromeHidden.dispatchOnUnload = function() {
240 chromeHidden.onUnload.dispatch(); 242 chromeHidden.onUnload.dispatch();
241 for (var i = 0; i < allAttachedEvents.length; ++i) { 243 for (var i = 0; i < allAttachedEvents.length; ++i) {
242 var event = allAttachedEvents[i]; 244 var event = allAttachedEvents[i];
243 if (event) 245 if (event)
244 event.detach_(); 246 event.detach_();
245 } 247 }
246 }; 248 };
247 249
248 chromeHidden.dispatchError = function(msg) { 250 chromeHidden.dispatchError = function(msg) {
249 console.error(msg); 251 console.error(msg);
250 }; 252 };
251 })(); 253 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698