~ubuntu-branches/ubuntu/trusty/ubufox/trusty-security

« back to all changes in this revision

Viewing changes to pfs/web/plugindata.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2015-01-09 19:45:49 UTC
  • mfrom: (1.3.6) (72.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20150109194549-k3biwzkrshu1c7o3
Tags: 3.0-0ubuntu0.14.04.1
* New upstream release
  - Delete the plugin installer wizard implementation and associated code.
    Upstream have disabled PFS and removed their plugin installer wizard now
  - Drop the search engine defaults - these have moved to Firefox
    (LP: #1398174)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
#
3
 
# Copyright (C) 2007  Canonical Ltd.
4
 
#
5
 
# This program is free software; you can redistribute it and/or modify
6
 
# it under the terms of the GNU General Public License as published by
7
 
# the Free Software Foundation; either version 2 of the License, or
8
 
# (at your option) any later version.
9
 
#
10
 
# This program is distributed in the hope that it will be useful,
11
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
# GNU General Public License for more details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License along
16
 
# with this program; if not, write to the Free Software Foundation, Inc.,
17
 
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
 
#
19
 
 
20
 
 
21
 
from xml.dom.xmlbuilder import *
22
 
import uuid
23
 
 
24
 
class MimeTypeDescription:
25
 
 
26
 
        def __init__ (mimetype):
27
 
                self.mimetype = mimetype
28
 
                self.pluginResults = None
29
 
 
30
 
 
31
 
class PluginDescription:
32
 
 
33
 
        def __init__ (  self, \
34
 
                        name, \
35
 
                        requestedMimetype, \
36
 
                        guid, \
37
 
                        version, \
38
 
                        IconUrl, \
39
 
                        XPILocation, \
40
 
                        InstallerShowsUI, \
41
 
                        manualInstallationURL, \
42
 
                        licenseURL, \
43
 
                        needsRestart, \
44
 
                        filehint, \
45
 
                        description ):
46
 
 
47
 
                self.guid = "{" + str(uuid.uuid1()) + "}"
48
 
                self.id="urn:mozilla:plugin:" + self.guid  + ":"
49
 
                self.name = name
50
 
                self.requestedMimetype = requestedMimetype
51
 
                self.version = version
52
 
                self.IconUrl = IconUrl
53
 
                self.XPILocation = XPILocation
54
 
                self.InstallerShowsUI = InstallerShowsUI
55
 
                self.manualInstallationURL = manualInstallationURL
56
 
                self.licenseURL = licenseURL
57
 
                self.needsRestart = needsRestart
58
 
                self.filehint = filehint
59
 
                self.description = description
60
 
 
61
 
        def to_element (self, doc):
62
 
                root_elem = doc.createElement( \
63
 
                                        "RDF:Description")
64
 
                root_elem.setAttribute("about", self.id)
65
 
 
66
 
                name_elem = doc.createElement( \
67
 
                                        "pfs:name")
68
 
                root_elem.appendChild(name_elem)
69
 
                name_text = doc.createTextNode(self.name)
70
 
                name_elem.appendChild(name_text)
71
 
 
72
 
                requestedMimetype_elem = doc.createElement( \
73
 
                                        "pfs:requestedMimetype")
74
 
                root_elem.appendChild(requestedMimetype_elem)
75
 
 
76
 
                if not self.requestedMimetype is None:
77
 
                        requestedMimetype_text = doc.createTextNode(self.requestedMimetype)
78
 
                        requestedMimetype_elem.appendChild(requestedMimetype_text)
79
 
 
80
 
                guid_elem = doc.createElement( \
81
 
                                        "pfs:guid")
82
 
 
83
 
                root_elem.appendChild(guid_elem)
84
 
                if not self.guid is None:
85
 
                        guid_text = doc.createTextNode(self.guid)
86
 
                        guid_elem.appendChild(guid_text)
87
 
 
88
 
                version_elem = doc.createElement( \
89
 
                                        "pfs:version")
90
 
                root_elem.appendChild(version_elem)
91
 
                if not self.version is None:
92
 
#                       version_text = doc.createTextNode(self.version)
93
 
                        version_elem.appendChild(version_text)
94
 
 
95
 
                IconUrl_elem = doc.createElement( \
96
 
                                        "pfs:IconUrl")
97
 
                root_elem.appendChild(IconUrl_elem)
98
 
                if not self.IconUrl is None:
99
 
                        IconUrl_text = doc.createTextNode(self.IconUrl)
100
 
                        IconUrl_elem.appendChild(IconUrl_text)
101
 
 
102
 
                XPILocation_elem = doc.createElement( \
103
 
                                        "pfs:XPILocation")
104
 
                root_elem.appendChild(XPILocation_elem)
105
 
                if not self.XPILocation is None:
106
 
                        XPILocation_text = doc.createTextNode(self.XPILocation)
107
 
                        XPILocation_elem.appendChild(XPILocation_text)
108
 
 
109
 
                manualInstallationURL_elem = doc.createElement( \
110
 
                                        "pfs:manualInstallationURL")
111
 
                root_elem.appendChild(manualInstallationURL_elem)
112
 
                if not self.manualInstallationURL is None:
113
 
                        manualInstallationURL_text = doc.createTextNode(self.manualInstallationURL)
114
 
                        manualInstallationURL_elem.appendChild(manualInstallationURL_text)
115
 
 
116
 
                licenseURL_elem = doc.createElement( \
117
 
                                        "pfs:licenseURL")
118
 
                root_elem.appendChild(licenseURL_elem)
119
 
                if not self.licenseURL is None:
120
 
                        licenseURL_text = doc.createTextNode(self.licenseURL)
121
 
                        licenseURL_elem.appendChild(licenseURL_text)
122
 
 
123
 
                needsRestart_elem = doc.createElement( \
124
 
                                        "pfs:needsRestart")
125
 
                root_elem.appendChild(needsRestart_elem)
126
 
                if not self.needsRestart is None:
127
 
                        needsRestart_text = doc.createTextNode(self.needsRestart)
128
 
                        needsRestart_elem.appendChild(needsRestart_text)
129
 
 
130
 
                filehint_elem = doc.createElement( \
131
 
                                        "pfs:filehint")
132
 
                root_elem.appendChild(filehint_elem)
133
 
                if not self.filehint is None:
134
 
                        filehint_text = doc.createTextNode(self.filehint)
135
 
                        filehint_elem.appendChild(filehint_text)
136
 
 
137
 
                description_elem = doc.createElement( \
138
 
                                        "pfs:description")
139
 
                root_elem.appendChild(description_elem)
140
 
                if not self.description is None:
141
 
                        description_text = doc.createTextNode(self.description)
142
 
                        description_elem.appendChild(description_text)
143
 
 
144
 
                return root_elem
145