summaryrefslogtreecommitdiff
path: root/chromium/extensions/renderer/resources/guest_view/extension_options/extension_options_events.js
blob: 20a2f1f8a6e3e1eaa61dda322100e80444929edf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var CreateEvent = require('guestViewEvents').CreateEvent;
var GuestViewEvents = require('guestViewEvents').GuestViewEvents;

function ExtensionOptionsEvents(extensionOptionsImpl) {
  GuestViewEvents.call(this, extensionOptionsImpl);

  // |setupEventProperty| is normally called automatically, but the
  // 'createfailed' event is registered here because the event is fired from
  // ExtensionOptionsImpl instead of in response to an extension event.
  this.setupEventProperty('createfailed');
}

ExtensionOptionsEvents.prototype.__proto__ = GuestViewEvents.prototype;

// A dictionary of <extensionoptions> extension events to be listened for. This
// dictionary augments |GuestViewEvents.EVENTS| in guest_view_events.js. See the
// documentation there for details.
ExtensionOptionsEvents.EVENTS = {
  'close': {
    evt: CreateEvent('extensionOptionsInternal.onClose')
  },
  'load': {
    evt: CreateEvent('extensionOptionsInternal.onLoad')
  },
  'preferredsizechanged': {
    evt: CreateEvent('extensionOptionsInternal.onPreferredSizeChanged'),
    fields:['width', 'height']
  }
}

ExtensionOptionsEvents.prototype.getEvents = function() {
  return ExtensionOptionsEvents.EVENTS;
};

// Exports.
exports.$set('ExtensionOptionsEvents', ExtensionOptionsEvents);