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

Side by Side Diff: extensions/renderer/resources/guest_view/extension_view_events.js

Issue 913393003: Restrict extensionview to chrome-extension:// (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Event management for ExtensionView.
6
7 var EventBindings = require('event_bindings');
8
9 var CreateEvent = function(name) {
10 var eventOpts = {supportsListeners: true, supportsFilters: true};
11 return new EventBindings.Event(name, undefined, eventOpts);
12 };
13
14 var EXTENSION_VIEW_EVENTS = {
15 'loadcommit': {
16 handler: function(event) {
17 ExtensionViewEvents.prototype.handleLoadCommitEvent.call(this, event);
18 },
19 evt: CreateEvent('extensionViewInternal.onLoadCommit'),
20 }
21 };
22
23 // Constructor.
24 function ExtensionViewEvents(extensionViewImpl, viewInstanceId) {
25 this.extensionViewImpl = extensionViewImpl;
26 this.viewInstanceId = viewInstanceId;
27
28 // Set up the events.
29 var events = this.getEvents();
30 for (var eventName in events) {
31 this.setupEvent(eventName, events[eventName]);
32 }
33 }
34
35 ExtensionViewEvents.prototype.getEvents = function() {
36 return EXTENSION_VIEW_EVENTS;
37 };
38
39 ExtensionViewEvents.prototype.setupEvent = function(name, info) {
40 info.evt.addListener(function(e) {
41 if (info.handler)
42 info.handler.call(this, e);
43 }.bind(this), {instanceId: this.viewInstanceId});
44 };
45
46 ExtensionViewEvents.prototype.handleLoadCommitEvent = function(event) {
47 this.extensionViewImpl.onLoadCommit(event.url);
48 };
49
50 exports.ExtensionViewEvents = ExtensionViewEvents;
OLDNEW
« no previous file with comments | « extensions/renderer/resources/guest_view/extension_view_constants.js ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698