summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/resources/extensions/page_actions_custom_bindings.js
blob: 515beb84fb0285e7cb163cfbf3c1d85d69f5851b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2012 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.

// Custom bindings for the pageActions API.

(function() {

native function GetChromeHidden();
native function GetCurrentPageActions();

GetChromeHidden().registerCustomHook(
    'pageActions', function(bindingsAPI, extensionId) {
  var pageActions = GetCurrentPageActions(extensionId);
  var oldStyleEventName = "pageActions";
  // TODO(EXTENSIONS_DEPRECATED): only one page action
  for (var i = 0; i < pageActions.length; ++i) {
    // Setup events for each extension_id/page_action_id string we find.
    chrome.pageActions[pageActions[i]] = new chrome.Event(oldStyleEventName);
  }
});

})();