blob: d1f8e5693a3a5a594989edc5ff5824eb97090ff2 [file] [log] [blame]
Wyatt Allenc1485932018-03-30 10:53:36 -07001/**
2 * @license
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17(function(window) {
18 'use strict';
19
20 // Prevent redefinition.
21 if (window.GrAdminApi) { return; }
22
23 function GrAdminApi(plugin) {
24 this.plugin = plugin;
25 plugin.on('admin-menu-links', this);
26 this._menuLinks = [];
27 }
28
29 /**
30 * @param {string} text
31 * @param {string} url
32 */
Thomas Draebing7880b0b2019-08-22 16:46:39 +020033 GrAdminApi.prototype.addMenuLink = function(text, url, opt_capability) {
34 this._menuLinks.push({text, url, capability: opt_capability || null});
Wyatt Allenc1485932018-03-30 10:53:36 -070035 };
36
37 GrAdminApi.prototype.getMenuLinks = function() {
38 return this._menuLinks.slice(0);
39 };
40
41 window.GrAdminApi = GrAdminApi;
42})(window);