[chrome-gnome-shell: 7/7] Merge branch 'feature/firefox'



commit 9e1ad1d65541c11d77415f312125622d8de2f4db
Merge: 0e3740e 3e74d31
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Dec 25 11:05:28 2016 +0400

    Merge branch 'feature/firefox'

 CMakeLists.txt                                     |   31 ++++++++++-
 .../org.gnome.chrome_gnome_shell.firefox.json      |    3 +
 extension/extension.html                           |    1 +
 extension/include/compat-common.js                 |   56 ++++++++++++++++++++
 extension/include/compat-content-script.js         |   51 ++++++++++++++++++
 extension/include/constants.js                     |    5 ++-
 extension/include/notifications.js                 |   16 ++++--
 extension/include/sync.js                          |    7 +--
 extension/manifest.firefox.json                    |   16 ++++++
 extension/manifest.json                            |    1 +
 extension/options.html                             |    1 +
 extension/options.js                               |   17 ++++++-
 12 files changed, 191 insertions(+), 14 deletions(-)
---
diff --cc extension/include/notifications.js
index 7913300,b2dc058..01d219e
--- a/extension/include/notifications.js
+++ b/extension/include/notifications.js
@@@ -9,52 -9,13 +9,54 @@@
   */
  
  GSC.notifications = (function($) {
 +      var DEFAULT_NOTIFICATION_OPTIONS = {
 +              type: chrome.notifications.TemplateType.BASIC,
 +              iconUrl: 'icons/GnomeLogo-128.png',
 +              title: m('gs_chrome'),
 +              buttons: [
 +                      {title: m('close')}
 +              ],
 +              priority: 2,
 +              isClickable: true,
 +              requireInteraction: true
 +      };
 +
 +      function remove_list(options) {
 +              if(options.items)
 +              {
 +                      var items = [];
 +                      for (k in options.items)
 +                      {
 +                              if (options.items.hasOwnProperty(k))
 +                              {
 +                                      items.push(options.items[k].title + ' ' + options.items[k].message);
 +                              }
 +                      }
 +
 +                      if(options.message && items)
 +                      {
 +                              options.message += "\n";
 +                      }
 +
 +                      options.message += items.join("\n");
 +
 +                      options.type = chrome.notifications.TemplateType.BASIC;
 +                      delete options.items;
 +              }
 +
 +              return options;
 +      }
 +
 +      /*
 +              @Deprecated: remove browser notifications in version 9
 +       */
        var browser = (function() {
                function init() {
-                       chrome.runtime.onStartup.addListener(function() {
-                               // Do nothing. We just need this callback to restore notifications
-                       });
+                       if(COMPAT.ON_STARTUP) {
+                               chrome.runtime.onStartup.addListener(function() {
+                                       // Do nothing. We just need this callback to restore notifications
+                               });
+                       }
  
                        chrome.notifications.onClosed.addListener(function (notificationId, byUser) {
                                if (!byUser)
@@@ -94,12 -62,27 +94,16 @@@
  
                function _create(name, options, callback)
                {
-                       if(IS_OPERA && options.buttons)
+                       if(!COMPAT.NOTIFICATIONS_BUTTONS && options.buttons)
                        {
                                delete options.buttons;
+                       }
+ 
+                       if(COMPAT.IS_OPERA)
+                       {
                                if(options.type === chrome.notifications.TemplateType.LIST)
                                {
 -                                      var items = [];
 -                                      for(k in options.items)
 -                                      {
 -                                              if(options.items.hasOwnProperty(k))
 -                                              {
 -                                                      items.push(options.items[k].title + ' ' + 
options.items[k].message);
 -                                              }
 -                                      }
 -                                      options.message += "\n" + items.join("\n");
 -
 -                                      options.type = chrome.notifications.TemplateType.BASIC;
 -                                      delete options.items;
 +                                      options = remove_list(options);
                                }
                        }
  
diff --cc extension/manifest.json
index beb6125,25e82eb..a3ff6ae
--- a/extension/manifest.json
+++ b/extension/manifest.json
@@@ -28,8 -28,14 +28,9 @@@
        "run_at": "document_start",
        "js": [
            "include/constants.js",
+           "include/compat-content-script.js",
            "content-script-start.js"
        ]
 -    },
 -    {
 -      "matches": ["https://extensions.gnome.org/*";],
 -      "run_at": "document_end",
 -      "js": ["content-script-end.js"]
      }
    ],
    "externally_connectable": {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]