~alexlauni/unity-chromium-extension/static-actions

« back to all changes in this revision

Viewing changes to chromium-extension/background-page.js

  • Committer: Alexandre Abreu
  • Date: 2012-09-12 16:29:57 UTC
  • mfrom: (171.1.1 latest)
  • Revision ID: alexandre.abreu@canonical.com-20120912162957-0iocfr32mxxjj2vj
Add support fort preauthorized applications; Some fixes in infobar code for integration steps

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
    */
140
140
   var matchesIntegrationScripts = function (plugin, url, repo, windowInfos, callback) {
141
141
     function askForApplicationInstallation(plugin, appName, url, installationCallback) {
142
 
       if (plugin.permissions_get_domain_dontask(appName))
 
142
       if (plugin.permissions_get_domain_dontask(appName)) {
143
143
         installationCallback ();
 
144
       }
144
145
 
145
146
       function installApp() {
146
147
         plugin.application_repository_install_application(repo, appName, installationCallback, null);
149
150
         plugin.permissions_dontask_domain(appName);
150
151
       }
151
152
 
152
 
       addInfobarRequestCallbackFor (windowInfos.tabId,
153
 
                                     function (result) {
154
 
                                       if (result === undefined) {
155
 
                                         installationCallback();
156
 
                                       }
157
 
                                       if (result)
158
 
                                         installApp();
159
 
                                       else
160
 
                                         addToIgnoreList();
161
 
                                     },
162
 
                                     "Do you want to install?",
163
 
                                     null);
164
 
       chrome.infobars.show ({tabId: windowInfos.tabId, path: "infobar.html"});
 
153
       if (!plugin.permissions_get_domain_preauthorized(appName)) {
 
154
         addInfobarRequestCallbackFor (windowInfos.tabId,
 
155
                                       function (result) {
 
156
                                         if (result === undefined) {
 
157
                                           installationCallback();
 
158
                                         }
 
159
                                         if (result)
 
160
                                           installApp();
 
161
                                         else
 
162
                                           addToIgnoreList();
 
163
                                       },
 
164
                                       "Do you want to install?",
 
165
                                       null);
 
166
         chrome.infobars.show ({tabId: windowInfos.tabId, path: "infobar.html"});
 
167
       }
 
168
       else {
 
169
         plugin.permissions_allow_domain(appName);
 
170
         installApp();
 
171
       }
 
172
 
165
173
     } // function askForApplicationInstallation
166
174
 
167
175
     var APPLICATION_STATUS_AVAILABLE = 0;
170
178
 
171
179
     var formatInstalledAppInfo = function (name, src) {
172
180
       return {
173
 
         name: names[i],
 
181
         name: name,
174
182
         content: src,
175
183
         requires: null,
176
184
         includes: null
211
219
       var scripts = gatherApplicationsStatuses(names);
212
220
 
213
221
       // we should have at most one script for a given app
214
 
       if (scripts && scripts.installed && scripts.installed.length == 1) {
215
 
         var name = scripts.installed[0];
 
222
       if (scripts && scripts.available && scripts.available.length == 1) {
 
223
         var name = scripts.available[0];
216
224
         askForApplicationInstallation (plugin,
217
225
                                        name,
218
226
                                        url,