Use the <code>chrome.notifications</code> API to create rich notifications using
templates and show these notifications to users in the system tray.
@constructor
@param {object} chrome
515388
function Notifications(chrome) {
  this.chrome = chrome;
  
  
  /**
   * Creates and displays a notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.create = sinon.stub();
  
  /**
   * Updates an existing notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.update = sinon.stub();
  
  /**
   * Clears the specified notification.
   * 
   * @param {string} notificationId 
   * @param {function} callback 
   */
  this.clear = sinon.stub();
  
  /**
   * Retrieves all the notifications.
   * 
   * @param {function} callback 
   */
  this.getAll = sinon.stub();
  
  /**
   * Retrieves whether the user has enabled notifications from this app or extension.
   * 
   * @param {function} callback 
   */
  this.getPermissionLevel = sinon.stub();
  
  
  /**
   */
  this.onClosed = new Event();
  
  /**
   */
  this.onClicked = new Event();
  
  /**
   */
  this.onButonClicked = new Event();
  
  /**
   */
  this.onPermissionLevelChanged = new Event();
  
  /**
   */
  this.onShowSettings = new Event();
  
}
953342
function Windows(chrome) {
    this.chrome = chrome;
    this.WINDOW_ID_NONE = -1;
    this.WINDOW_ID_CURRENT = -2;

    /**
     * Gets details about a window.
     *
     * @param {number} tabId
     * @param {function} callback
     */
    this.get = sinon.stub();

    /**
     * Gets the current window
     *
     * @param {function} callback
     */
    this.getCurrent = sinon.stub();

    /**
     * Gets the window that was most recently focused — typically the window 'on top'.
     *
     * @param {function} callback
     */
    this.getLastFocused = sinon.stub();

    /**
     * Gets all windows.
     *
     * @param {function} callback
     */
    this.getAll = sinon.stub();
    /**
     * Creates (opens) a new browser with any optional sizing, position or default URL provided.
     *
     * @param {function} callback
     */
    this.create = sinon.stub();

    /**
     * Updates the properties of a window. Specify only the properties that you want to change;
     * unspecified properties will be left unchanged.
     *
     * @param {function} callback
     */
    this.update = sinon.stub();

    /**
     * Removes (closes) a window, and all the tabs inside it.
     *
     * @param {function} callback
     */
    this.remove = sinon.stub();
}
21310
@SuppressLint("SetTextI18n")
	public void setNotifications(Integer notifications) {

		if ((notifications != null) && (notifications > 0)) {
			setVisibility(VISIBLE);
			if (notifications > maximum) {
				this.setText(maximum + "+");
			} else {
				this.setText(notifications.toString());
			}
		} else {
			setVisibility(GONE);
		}
	}
346024
function() {
			var that = this,
				add = function(target, events, capture) {
					events.split(' ').forEach(function(type) {
						target.addEventListener(type, that, capture);
					});
				};
			add(document, 'DOMContentLoaded');
			add(document, 'click mousedown mouseup', true);
			add(window, 'load hashchange');
			if (!gui.hosted) {
				add(window, 'resize orientationchange');
			}
			if (!(window.chrome && chrome.app && chrome.runtime)) {
				add(window, 'unload');
			}
			
			/*
			if (document.readyState === "complete") { // TODO: IE cornercase?
				if (!this._loaded) {
					this._ondom();
					this._onload();
				}
			}
			*/
		}
494429
function notifyRetroactively(object) {
  if (object && typeof object === 'object') {
    const type = 'add';
    var notifier = Object.getNotifier(object);
    keys(object).forEach(name => notifier.notify({type, name, object}));
  }
  return object;
}
69709
function notify() {
    var args = arguments
    handlers.forEach(function(f){ f.apply(null, args) }) }
1012215
function _Emitter() {
		var eventTarget = document.createDocumentFragment();
		["addEventListener", "dispatchEvent", "removeEventListener"].forEach(function(method) {
			if (!this[method]) this[method] = eventTarget[method].bind(eventTarget);
		}, this);
	}
544447
function (msg) {
            var i,
                sheet,
                text = "";
            for (i = 0; i < window.document.styleSheets.length; i++) {
                sheet = window.document.styleSheets[i];
                // if it was already 'reloaded'
                if (sheet.ownerNode.id ===  msg.params.url) {
                    text = sheet.ownerNode.textContent;
                } else if (sheet.href === msg.params.url && !sheet.disabled) {
                    var j,
                        rules;

                    // Deal with Firefox's SecurityError when accessing sheets
                    // from other domains, and Chrome returning `undefined`.
                    try {
                        rules = window.document.styleSheets[i].cssRules;
                    } catch (e) {
                        if (e.name !== "SecurityError") {
                            throw e;
                        }
                    }
                    if (!rules) {
                        return;
                    }

                    for (j = 0; j < rules.length; j++) {
                        text += rules[j].cssText + '\n';
                    }
                }
            }

            MessageBroker.respond(msg, {
                text: text
            });
        }
889812
function() {
		var t = this;
		// Native events
		if (zyMedia.features.nativeFullscreenPrefix != '-') {
			// Chrome doesn't alays fire this in an iframe
			var func = function(e) {
				if (t.isFullScreen) {
					if (!isInFullScreenMode()) {
						t.exitFullScreen()
					}
				}
			};

			document.addEventListener(zyMedia.features.nativeFullscreenPrefix + 'fullscreenchange', func)
		}

		t.fullscreenBtn = document.createElement('div');
		t.fullscreenBtn.className = 'zy_fullscreen_btn';
		t.controls.appendChild(t.fullscreenBtn);

		t.fullscreenBtn.addEventListener('click', function() {
			if ((zyMedia.features.nativeFullscreenPrefix != '-' && isInFullScreenMode()) || t.isFullScreen) {
				t.exitFullScreen()
			} else {
				t.enterFullScreen()
			}
		});
	}
93868
function() {

          if(!this.getStyle('showArchiveStatus')) {
            logAnalyticsEvent('showArchiveStatus', 'createChrome', {mode: 'off'});
          }

          var widgets = {
            backingBar: new OT.Chrome.BackingBar({
              nameMode: !_properties.name ? 'off' : this.getStyle('nameDisplayMode'),
              muteMode: chromeButtonMode.call(this, this.getStyle('buttonDisplayMode'))
            }),

            name: new OT.Chrome.NamePanel({
              name: _properties.name,
              mode: this.getStyle('nameDisplayMode')
            }),

            muteButton: new OT.Chrome.MuteButton({
              muted: _properties.publishAudio === false,
              mode: chromeButtonMode.call(this, this.getStyle('buttonDisplayMode'))
            }),

            archive: new OT.Chrome.Archiving({
              show: this.getStyle('showArchiveStatus'),
              archiving: false
            })
          };

          if (_audioLevelCapable) {
            var audioLevelTransformer = new OT.AudioLevelTransformer();

            var audioLevelUpdatedHandler = function(evt) {
              _audioLevelMeter.setValue(audioLevelTransformer.transform(evt.audioLevel));
            };

            _audioLevelMeter = new OT.Chrome.AudioLevelMeter({
              mode: this.getStyle('audioLevelDisplayMode'),
              onActivate: function() {
                _publisher.on('audioLevelUpdated', audioLevelUpdatedHandler);
              },
              onPassivate: function() {
                _publisher.off('audioLevelUpdated', audioLevelUpdatedHandler);
              }
            });

            widgets.audioLevel = _audioLevelMeter;
          }

          _chrome = new OT.Chrome({
            parent: _widgetView.domElement
          }).set(widgets).on({
            muted: OT.$.bind(this.publishAudio, this, false),
            unmuted: OT.$.bind(this.publishAudio, this, true)
          });

          if(_audioLevelMeter && this.getStyle('audioLevelDisplayMode') === 'auto') {
            _audioLevelMeter[_widgetView.audioOnly() ? 'show' : 'hide']();
          }
        }
1245569
function (webContents) {
  const tabId = webContents.id

  sendToBackgroundPages('CHROME_TABS_ONCREATED')

  webContents.on('will-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.on('did-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONCOMPLETED', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.once('destroyed', () => {
    sendToBackgroundPages('CHROME_TABS_ONREMOVED', tabId)
  })
}
128370
function() {
		var args = Array.prototype.slice.call(arguments);
		var type = args.shift();
		var message = args.shift();

		if (_config.allow.indexOf(type) === -1) {
			return true;
		}

		if (type === 'error') {
			// only one notify error message.
			if (_check(message) !== false) {
				return _this;
			}

			message = _config.mention.join(' ') + ' ' + message;
		}

		args.unshift(message);
		args.unshift(_config.prefix);

		_client.notify(_config.room, {
			message: args.join("\n"),
			token: _config.room_token,
			notify: true,
			message_format: 'text',
			color: _COLOR[type || 'info']
		}, function(err) {
			if (err !== null) {
				console.error(err);
			}
		});

		return _this;
	}
1047283
function( notifyRenderer ){
      var cy = this._private.cy;
      var style = cy.style();
      notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;

      style.apply( this );

      var updatedCompounds = this.updateCompoundBounds();

      if( notifyRenderer ){
        this.add( updatedCompounds ).rtrigger('style'); // let renderer know we changed style
      } else {
        this.add( updatedCompounds ).trigger('style'); // just fire the event
      }
      return this; // chaining
    }
901373
function showNotification(data) {
  if (!data || !data.tag) {
    // eslint-disable-next-line no-param-reassign
    data = $Notifications.default;
  }
  logger.group(data.tag);
  logger.log('Show notification.', data.tag);
  return self.registration
    .showNotification(data.title, data)
    .then(delayDismissNotification);
}
238450
def create_notifications(users, notification_model, notification_type, related_object):
    
    # shortcuts for readability
    Notification = notification_model

    # text
    additional = related_object.__dict__ if related_object else ''
    notification_text = TEXTS[notification_type] % additional

    # loop users, notification settings check is done in Notification model
    for user in users:

        n = Notification(
            to_user=user,
            type=notification_type,
            text=notification_text
        )
        # attach related object if present
        if related_object:
            n.related_object = related_object
        # create notification and send according to user settings
        n.save()
1237778
def generate_html(self, notifications):
        
        html_chunks = []
        for nf in notifications:
            extra = nf.as_json() if self.target == 'box' else {}
            html = render_notification(nf, render_target=self.target, **extra)
            html_chunks.append(html)
        if not html_chunks:
            html_chunks.append(_("<b>No notifications yet.</b>"))
        html_string = '\n'.join(html_chunks)
        return html_string
1310028
function () {
            /*  determine parameters  */
            var params = $cs.params("notify", arguments, {
                name:    { pos: 0,     req: true                                          },
                args:    { pos: "...", def: []                                            },
                matches: {             def: function (p, l) { return p.name === l.name; } } /* customized matching */
            });

              */
            for (var id in this.__listener) {
                if (_cs.isown(this.__listener, id)) {
                    var listener = this.__listener[id];
                    if (params.matches(params, listener)) {
                        var args = _cs.concat(listener.args, params.args);
                        listener.func.apply(listener.ctx, args);
                    }
                }
            }
        }