title: chrome extension: desktop notification from a background script
body: <p>I tried to modified the original notification sample and I found that the old webit notification does not work any more.So I changed to chrome notification. Basically, I still reuse the background page like this:</p>
  
  <pre><code>"permissions": [
      "notifications",
      "http://*/*" 
    ],
    "options_page": "options.html",
    "background": { "scripts": ["background.js"], "persistent": false },
  </code></pre>
  
  <p>Any the background.js is just like this:</p>
  
  <pre><code>console.log("Before create " + notID + " notification");
  chrome.notifications.create("id"+notID++, options, creationCallback);
  
  
  function creationCallback(ID) {
    console.log("Succesfully created " + ID + " notification");
  }
  </code></pre>
  
  <p>Looks like something is not configured right and I cannot see the notification. And I see the following log:</p>
  
  <pre><code>Before create 0 notification background.js:87
  Succesfully created undefined notification background.js:92
  </code></pre>
  
  <p>Anything do I still miss here?</p>
  
  <p>Thanks</p>
  
  <p>Update: Here is the modified background.js</p>
  
  <pre><code>window.addEventListener('load', function() {
    var opt = {
      iconUrl: "48.png",
      type: 'list',
      title: 'Primary Title',
      message: 'Primary message to display',
      priority: 1,
      items: [{ title: 'Item1', message: 'This is item 1.'},
              { title: 'Item2', message: 'This is item 2.'},
              { title: 'Item3', message: 'This is item 3.'}]
    };
    chrome.notifications.create('notify1', opt, function() { console.log('created!');console.log(chrome.runtime.lastError)});
  });
  </code></pre>
  
  <p>Here is the completed manifest.json:</p>
  
  <pre><code>{
    "name": "Notification Demo",
    "version": "1.1",
    "description":
      "Shows off desktop notifications, which are \"toast\" windows that pop up on the desktop.",
    "icons": {"16": "16.png", "48": "48.png", "128": "128.png"},
    "permissions": [
      "notifications",
      "http://*/*" 
    ],
    "options_page": "options.html",
    "background": { "scripts": ["background.js"]},
    "manifest_version": 2,
  
    // crbug.com/134315
    "web_accessible_resources": [
      "48.png"
    ]
  }
  </code></pre>