1
|
|
|
/* |
2
|
|
|
* To change this license header, choose License Headers in Project Properties. |
3
|
|
|
* To change this template file, choose Tools | Templates |
4
|
|
|
* and open the template in the editor. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/* global API */ |
9
|
|
|
|
10
|
|
|
API.browserAction = { |
11
|
|
|
setTitle: API.api.browserAction.setTitle, |
12
|
|
|
getTitle: function(details) { |
13
|
|
|
if (API.promise) { |
14
|
|
|
return API.api.browserAction.getTitle(details); |
15
|
|
|
} |
16
|
|
|
else { |
17
|
|
|
return new C_Promise(function() { |
18
|
|
|
API.api.browserAction.getTitle(details, (function(title) { |
19
|
|
|
this.call_then(title); |
20
|
|
|
}).bind(this)); |
21
|
|
|
}); |
22
|
|
|
} |
23
|
|
|
}, |
24
|
|
|
setIcon: function(details) { |
25
|
|
|
if (API.promise) { |
26
|
|
|
return API.api.browserAction.setIcon(details); |
27
|
|
|
} |
28
|
|
|
else { |
29
|
|
|
return new API.api.browserAction.setIcon(details, (function(){ |
30
|
|
|
this.call_then(); |
31
|
|
|
}).bind(this)); |
32
|
|
|
} |
33
|
|
|
}, |
34
|
|
|
setPopup: API.api.browserAction.setPopup, |
35
|
|
|
getPopup: function(details) { |
36
|
|
|
if (API.promise) { |
37
|
|
|
return API.api.browserAction.getPopup(details); |
38
|
|
|
} |
39
|
|
|
else { |
40
|
|
|
return new C_Promise(function() { |
41
|
|
|
API.api.browserAction.getPopup(details, (function(url) { |
42
|
|
|
this.call_then(url); |
43
|
|
|
}).bind(this)); |
44
|
|
|
}); |
45
|
|
|
} |
46
|
|
|
}, |
47
|
|
|
setBadgeText: API.api.browserAction.setBadgeText, |
48
|
|
|
getBadgeText: function(details) { |
49
|
|
|
if (API.promise) { |
50
|
|
|
return API.api.browserAction.getBadgeText(details); |
51
|
|
|
} |
52
|
|
|
else { |
53
|
|
|
return new C_Promise(function() { |
54
|
|
|
API.api.browserAction.getBadgeText(details, (function(text) { |
55
|
|
|
this.call_then(text); |
56
|
|
|
}).bind(this)); |
57
|
|
|
}); |
58
|
|
|
} |
59
|
|
|
}, |
60
|
|
|
setBadgeBackgroundColor: API.api.browserAction.setBadgeBackgroundColor, |
61
|
|
|
getBadgeBackgroundColor: function(details) { |
62
|
|
|
if (API.promise) { |
63
|
|
|
return API.api.browserAction.getBadgeBackgroundColor(details); |
64
|
|
|
} |
65
|
|
|
else { |
66
|
|
|
return new C_Promise(function() { |
67
|
|
|
API.api.browserAction.getBadgeBackgroundColor(details, (function(colour) { |
68
|
|
|
this.call_then(colour); |
69
|
|
|
}).bind(this)); |
70
|
|
|
}); |
71
|
|
|
} |
72
|
|
|
}, |
73
|
|
|
enable: API.api.browserAction.enable, |
74
|
|
|
disable: API.api.browserAction.disable, |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Events from now on |
78
|
|
|
*/ |
79
|
|
|
onClicked: API.api.browserAction.onClicked |
80
|
|
|
}; |