~abreu-alexandre/unity-webapps-qml/port-to-oxide

« back to all changes in this revision

Viewing changes to src/Ubuntu/UnityWebApps/UnityWebApps.js

  • Committer: CI bot
  • Author(s): Ken VanDine, Alexandre Abreu
  • Date: 2014-06-26 01:48:23 UTC
  • mfrom: (118.2.16 add-content-hub-share)
  • Revision ID: ps-jenkins@lists.canonical.com-20140626014823-xeq9pk3ff4oixq8l
add content share 

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
     * \param backends
37
37
     * \param userscriptContent
38
38
     */
39
 
    function _UnityWebApps(parentItem, bindeeProxies) {
 
39
    function _UnityWebApps(parentItem, bindeeProxies, accessPolicy) {
40
40
        this._injected_unity_api_path = Qt.resolvedUrl('unity-webapps-api.js');
41
41
        this._bindeeProxies = bindeeProxies;
42
42
        this._backends = null;
43
43
        this._userscripts = [];
 
44
        this._accessPolicy = accessPolicy;
44
45
 
45
46
        this._bind();
46
47
    };
70
71
         */
71
72
        _bind: function () {
72
73
            var self = this;
73
 
 
74
74
            var cb = this._onMessageReceivedCallback.bind(self);
75
75
            self._bindeeProxies.messageReceivedConnect(cb);
76
76
 
147
147
                    var cb = this._wrapCallbackIds (message.callback);
148
148
                    params.push(cb);
149
149
                }
 
150
 
 
151
                var apiCallName = message.name;
 
152
                if (this._accessPolicy && this._accessPolicy.allowed && !this._accessPolicy.allowed(apiCallName)) {
 
153
                    console.error("Unauthorize API call blocked: " + apiCallName);
 
154
                    return;
 
155
                }
 
156
 
150
157
                this._dispatchApiCall (message.name, params);
151
158
 
152
159
            } else if (target === UnityWebAppsUtils.UBUNTU_WEBAPPS_BINDING_OBJECT_METHOD_CALL_MESSAGE) {