~ubuntu-branches/ubuntu/wily/unity-webapps-qml/wily-proposed

« back to all changes in this revision

Viewing changes to src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-06-26 01:48:37 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: package-import@ubuntu.com-20140626014837-yybq0b9u0cnjsddv
Tags: upstream-0.1+14.10.20140626.1
ImportĀ upstreamĀ versionĀ 0.1+14.10.20140626.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *
25
25
 */
26
26
 
27
 
function createContentHubApi(backendDelegate) {
 
27
function createContentHubApi(backendDelegate, accessPolicy) {
28
28
    var PLUGIN_URI = 'Ubuntu.Content';
29
29
    var VERSION = 0.1;
30
30
 
39
39
            "Documents": ContentHubBridge.ContentType.Documents,
40
40
            "Music": ContentHubBridge.ContentType.Music,
41
41
            "Contacts": ContentHubBridge.ContentType.Contacts,
 
42
            "Videos": ContentHubBridge.ContentType.Videos,
 
43
            "Links": ContentHubBridge.ContentType.Links,
42
44
        };
43
45
        return name in contentTypePerName ?
44
46
                    contentTypePerName[name]
57
59
            return "Music";
58
60
        else if (state === ContentHubBridge.ContentType.Contacts)
59
61
            return "Contacts";
 
62
        else if (state === ContentHubBridge.ContentType.Videos)
 
63
            return "Videos";
 
64
        else if (state === ContentHubBridge.ContentType.Links)
 
65
            return "Links";
60
66
        return "Unknown";
61
67
    };
62
68
 
146
152
            "Collected": ContentHubBridge.ContentTransfer.Collected,
147
153
            "Aborted": ContentHubBridge.ContentTransfer.Aborted,
148
154
            "Finalized": ContentHubBridge.ContentTransfer.Finalized,
 
155
            "Downloading": ContentHubBridge.ContentTransfer.Downloading,
 
156
            "Downloaded": ContentHubBridge.ContentTransfer.Downloaded,
149
157
        };
150
158
        return name in contentTransferStatePerName ?
151
159
                    contentTransferStatePerName[name]
166
174
            return "Aborted";
167
175
        else if (state === ContentHubBridge.ContentTransfer.Finalized)
168
176
            return "Finalized";
 
177
        else if (state === ContentHubBridge.ContentTransfer.Downloading)
 
178
            return "Downloading";
 
179
        else if (state === ContentHubBridge.ContentTransfer.Downloaded)
 
180
            return "Downloaded";
169
181
        return "<Unknown State>";
170
182
    };
171
183
 
769
781
            });
770
782
        },
771
783
 
 
784
        onImportRequested: function(callback) {
 
785
            _contenthub.onImportRequested.connect(function(importTransfer) {
 
786
                var wrapped = new ContentTransfer(importTransfer);
 
787
                callback(wrapped.serialize());
 
788
            });
 
789
        },
 
790
 
 
791
        onShareRequested: function(callback) {
 
792
            _contenthub.shareRequested.connect(function(shareTransfer) {
 
793
                var wrapped = new ContentTransfer(shareTransfer);
 
794
                callback(wrapped.serialize());
 
795
            });
 
796
        },
 
797
 
772
798
        // Internal
773
799
 
774
800
        dispatchToObject: function(infos) {