{"action":"created","comment":{"url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/comments/24720342","id":24720342,"diff_hunk":"@@ -0,0 +1,65 @@\n+// Copyright (c) 2015 Intel Corporation. All rights reserved.\n+// Use of this source code is governed by a BSD-style license that can be\n+// found in the LICENSE file.\n+\n+#ifndef XWALK_RUNTIME_BROWSER_LINUX_XWALK_NOTIFICATION_MANAGER_H_\n+#define XWALK_RUNTIME_BROWSER_LINUX_XWALK_NOTIFICATION_MANAGER_H_\n+\n+#include <libnotify/notification.h>\n+#include <libnotify/notify.h>\n+\n+#include <map>\n+\n+#include \"base/callback.h\"\n+#include \"base/containers/scoped_ptr_hash_map.h\"\n+#include \"base/strings/string16.h\"\n+\n+class GURL;\n+class SkBitmap;\n+\n+namespace content {\n+class BrowserContext;\n+class DesktopNotificationDelegate;\n+class RenderFrameHost;\n+struct PlatformNotificationData;\n+}\n+\n+namespace xwalk {\n+\n+class XWalkNotificationManager {\n+ public:\n+  XWalkNotificationManager();\n+  virtual ~XWalkNotificationManager();\n+\n+  // Show a desktop notification. If |cancel_callback| is non-null, it's set to\n+  // a callback which can be used to cancel the notification.\n+  void ShowDesktopNotification(\n+      content::BrowserContext* browser_context,\n+      const GURL& origin,\n+      const content::PlatformNotificationData& notification_data,\n+      scoped_ptr<content::DesktopNotificationDelegate> delegate,\n+      int render_process_id,\n+      base::Closure* cancel_callback);\n+\n+  void NotificationDisplayed(NotifyNotification* notification);\n+  void NotificationClicked(NotifyNotification* notification);\n+  void NotificationClosed(NotifyNotification* notification, bool by_user);\n+\n+  gulong closed_handler(NotifyNotification* notification) const {","path":"runtime/browser/linux/xwalk_notification_manager.h","position":48,"original_position":48,"commit_id":"e495ac02077301d23387b2634a4121c37a3d207a","original_commit_id":"e495ac02077301d23387b2634a4121c37a3d207a","user":{"login":"PeterWangIntel","id":4970060,"avatar_url":"https://avatars.githubusercontent.com/u/4970060?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterWangIntel","html_url":"https://github.com/PeterWangIntel","followers_url":"https://api.github.com/users/PeterWangIntel/followers","following_url":"https://api.github.com/users/PeterWangIntel/following{/other_user}","gists_url":"https://api.github.com/users/PeterWangIntel/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterWangIntel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterWangIntel/subscriptions","organizations_url":"https://api.github.com/users/PeterWangIntel/orgs","repos_url":"https://api.github.com/users/PeterWangIntel/repos","events_url":"https://api.github.com/users/PeterWangIntel/events{/privacy}","received_events_url":"https://api.github.com/users/PeterWangIntel/received_events","type":"User","site_admin":false},"body":"Sorry, it's mistake. In the draft patch it was a member variable of class. ","created_at":"2015-02-15T07:16:17Z","updated_at":"2015-02-15T07:16:17Z","html_url":"https://github.com/crosswalk-project/crosswalk/pull/2853#discussion_r24720342","pull_request_url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853","_links":{"self":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/comments/24720342"},"html":{"href":"https://github.com/crosswalk-project/crosswalk/pull/2853#discussion_r24720342"},"pull_request":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853"}}},"pull_request":{"url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853","id":28901979,"html_url":"https://github.com/crosswalk-project/crosswalk/pull/2853","diff_url":"https://github.com/crosswalk-project/crosswalk/pull/2853.diff","patch_url":"https://github.com/crosswalk-project/crosswalk/pull/2853.patch","issue_url":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/2853","number":2853,"state":"open","locked":false,"title":"WebNotification of Crosswalk Linux","user":{"login":"PeterWangIntel","id":4970060,"avatar_url":"https://avatars.githubusercontent.com/u/4970060?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterWangIntel","html_url":"https://github.com/PeterWangIntel","followers_url":"https://api.github.com/users/PeterWangIntel/followers","following_url":"https://api.github.com/users/PeterWangIntel/following{/other_user}","gists_url":"https://api.github.com/users/PeterWangIntel/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterWangIntel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterWangIntel/subscriptions","organizations_url":"https://api.github.com/users/PeterWangIntel/orgs","repos_url":"https://api.github.com/users/PeterWangIntel/repos","events_url":"https://api.github.com/users/PeterWangIntel/events{/privacy}","received_events_url":"https://api.github.com/users/PeterWangIntel/received_events","type":"User","site_admin":false},"body":"The WebNotification of Crosswalk Linux is implemented based on 'libnotify'.\r\nRefering to https://wiki.archlinux.org/index.php/Desktop_notifications,\r\nthe 'libnotify' is a desktop independent lib to invoke 'notification server'\r\nthrough DBus named 'org.freedesktop.Notifications' (on Ubuntu it's 'notify-osd' behind).\r\n\r\nThere 3 reasons to use 'libnotify'\r\n(1) The Chrome Linux creates 'desktop notification' by self and it's hard to port since most of\r\n    code is for 'Rich notification' proveded by extension.\r\n    refer to https://developer.chrome.com/apps/richNotifications.\r\n(2) Firefox and WebKit using 'libnotify' to implement WebNotification.\r\n(3) The desktop of Deepin supports 'libnotify' by default.\r\n\r\nAdd a new class 'XWalkNotificationManagerLinux' to implement logic to invoke 'libnotify':\r\n(1) Init and uninit 'libnotify' in constructor and destructor.\r\n(2) In 'ShowDesktopNotification', call 'notify_notification_new' and 'notify_notification_show'\r\n    to create new notifaication record and show it.\r\n    If just need to relace old notification, call 'notify_notification_update' to update the\r\n    record.\r\n(3) Listen signal 'closed' with callback 'NotificationClosedCallback' to trigger the JS callbacks,\r\n    such as 'Notification.onclose'.\r\n(4) The memeber 'notifications_map_' is for saving the map between 'notification' and its\r\n    'delegate' (used to trigger JS callbacks).\r\n    The 'notifications_replace_map_' is used to record the notification created with relace tag,\r\n    like this:\r\n\t new Notification(\"***\", {tag: '***'});\r\n\r\nBUG=https://crosswalk-project.org/jira/browse/XWALK-286","created_at":"2015-02-09T07:55:30Z","updated_at":"2015-02-15T07:16:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"079e2f33c26be8029615f13578cf6e3731b4c41e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853/commits","review_comments_url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853/comments","review_comment_url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/comments/{number}","comments_url":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/2853/comments","statuses_url":"https://api.github.com/repos/crosswalk-project/crosswalk/statuses/e495ac02077301d23387b2634a4121c37a3d207a","head":{"label":"PeterWangIntel:notification","ref":"notification","sha":"e495ac02077301d23387b2634a4121c37a3d207a","user":{"login":"PeterWangIntel","id":4970060,"avatar_url":"https://avatars.githubusercontent.com/u/4970060?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterWangIntel","html_url":"https://github.com/PeterWangIntel","followers_url":"https://api.github.com/users/PeterWangIntel/followers","following_url":"https://api.github.com/users/PeterWangIntel/following{/other_user}","gists_url":"https://api.github.com/users/PeterWangIntel/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterWangIntel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterWangIntel/subscriptions","organizations_url":"https://api.github.com/users/PeterWangIntel/orgs","repos_url":"https://api.github.com/users/PeterWangIntel/repos","events_url":"https://api.github.com/users/PeterWangIntel/events{/privacy}","received_events_url":"https://api.github.com/users/PeterWangIntel/received_events","type":"User","site_admin":false},"repo":{"id":13032248,"name":"crosswalk","full_name":"PeterWangIntel/crosswalk","owner":{"login":"PeterWangIntel","id":4970060,"avatar_url":"https://avatars.githubusercontent.com/u/4970060?v=3","gravatar_id":"","url":"https://api.github.com/users/PeterWangIntel","html_url":"https://github.com/PeterWangIntel","followers_url":"https://api.github.com/users/PeterWangIntel/followers","following_url":"https://api.github.com/users/PeterWangIntel/following{/other_user}","gists_url":"https://api.github.com/users/PeterWangIntel/gists{/gist_id}","starred_url":"https://api.github.com/users/PeterWangIntel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeterWangIntel/subscriptions","organizations_url":"https://api.github.com/users/PeterWangIntel/orgs","repos_url":"https://api.github.com/users/PeterWangIntel/repos","events_url":"https://api.github.com/users/PeterWangIntel/events{/privacy}","received_events_url":"https://api.github.com/users/PeterWangIntel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PeterWangIntel/crosswalk","description":"","fork":true,"url":"https://api.github.com/repos/PeterWangIntel/crosswalk","forks_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/forks","keys_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/teams","hooks_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/hooks","issue_events_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/issues/events{/number}","events_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/events","assignees_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/assignees{/user}","branches_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/branches{/branch}","tags_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/tags","blobs_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/git/refs{/sha}","trees_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/statuses/{sha}","languages_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/languages","stargazers_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/stargazers","contributors_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/contributors","subscribers_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/subscribers","subscription_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/subscription","commits_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/commits{/sha}","git_commits_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/git/commits{/sha}","comments_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/comments{/number}","issue_comment_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/issues/comments/{number}","contents_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/contents/{+path}","compare_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/merges","archive_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/downloads","issues_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/issues{/number}","pulls_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/pulls{/number}","milestones_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/milestones{/number}","notifications_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/labels{/name}","releases_url":"https://api.github.com/repos/PeterWangIntel/crosswalk/releases{/id}","created_at":"2013-09-23T09:53:37Z","updated_at":"2014-06-12T13:06:33Z","pushed_at":"2015-02-13T08:16:22Z","git_url":"git://github.com/PeterWangIntel/crosswalk.git","ssh_url":"git@github.com:PeterWangIntel/crosswalk.git","clone_url":"https://github.com/PeterWangIntel/crosswalk.git","svn_url":"https://github.com/PeterWangIntel/crosswalk","homepage":null,"size":12259,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crosswalk-project:master","ref":"master","sha":"08b7b07f4993a22ee2a02b069f661e31fd2478ad","user":{"login":"crosswalk-project","id":4867377,"avatar_url":"https://avatars.githubusercontent.com/u/4867377?v=3","gravatar_id":"","url":"https://api.github.com/users/crosswalk-project","html_url":"https://github.com/crosswalk-project","followers_url":"https://api.github.com/users/crosswalk-project/followers","following_url":"https://api.github.com/users/crosswalk-project/following{/other_user}","gists_url":"https://api.github.com/users/crosswalk-project/gists{/gist_id}","starred_url":"https://api.github.com/users/crosswalk-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosswalk-project/subscriptions","organizations_url":"https://api.github.com/users/crosswalk-project/orgs","repos_url":"https://api.github.com/users/crosswalk-project/repos","events_url":"https://api.github.com/users/crosswalk-project/events{/privacy}","received_events_url":"https://api.github.com/users/crosswalk-project/received_events","type":"Organization","site_admin":false},"repo":{"id":9207280,"name":"crosswalk","full_name":"crosswalk-project/crosswalk","owner":{"login":"crosswalk-project","id":4867377,"avatar_url":"https://avatars.githubusercontent.com/u/4867377?v=3","gravatar_id":"","url":"https://api.github.com/users/crosswalk-project","html_url":"https://github.com/crosswalk-project","followers_url":"https://api.github.com/users/crosswalk-project/followers","following_url":"https://api.github.com/users/crosswalk-project/following{/other_user}","gists_url":"https://api.github.com/users/crosswalk-project/gists{/gist_id}","starred_url":"https://api.github.com/users/crosswalk-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosswalk-project/subscriptions","organizations_url":"https://api.github.com/users/crosswalk-project/orgs","repos_url":"https://api.github.com/users/crosswalk-project/repos","events_url":"https://api.github.com/users/crosswalk-project/events{/privacy}","received_events_url":"https://api.github.com/users/crosswalk-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crosswalk-project/crosswalk","description":"","fork":false,"url":"https://api.github.com/repos/crosswalk-project/crosswalk","forks_url":"https://api.github.com/repos/crosswalk-project/crosswalk/forks","keys_url":"https://api.github.com/repos/crosswalk-project/crosswalk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crosswalk-project/crosswalk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crosswalk-project/crosswalk/teams","hooks_url":"https://api.github.com/repos/crosswalk-project/crosswalk/hooks","issue_events_url":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/events{/number}","events_url":"https://api.github.com/repos/crosswalk-project/crosswalk/events","assignees_url":"https://api.github.com/repos/crosswalk-project/crosswalk/assignees{/user}","branches_url":"https://api.github.com/repos/crosswalk-project/crosswalk/branches{/branch}","tags_url":"https://api.github.com/repos/crosswalk-project/crosswalk/tags","blobs_url":"https://api.github.com/repos/crosswalk-project/crosswalk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crosswalk-project/crosswalk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crosswalk-project/crosswalk/git/refs{/sha}","trees_url":"https://api.github.com/repos/crosswalk-project/crosswalk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crosswalk-project/crosswalk/statuses/{sha}","languages_url":"https://api.github.com/repos/crosswalk-project/crosswalk/languages","stargazers_url":"https://api.github.com/repos/crosswalk-project/crosswalk/stargazers","contributors_url":"https://api.github.com/repos/crosswalk-project/crosswalk/contributors","subscribers_url":"https://api.github.com/repos/crosswalk-project/crosswalk/subscribers","subscription_url":"https://api.github.com/repos/crosswalk-project/crosswalk/subscription","commits_url":"https://api.github.com/repos/crosswalk-project/crosswalk/commits{/sha}","git_commits_url":"https://api.github.com/repos/crosswalk-project/crosswalk/git/commits{/sha}","comments_url":"https://api.github.com/repos/crosswalk-project/crosswalk/comments{/number}","issue_comment_url":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/comments/{number}","contents_url":"https://api.github.com/repos/crosswalk-project/crosswalk/contents/{+path}","compare_url":"https://api.github.com/repos/crosswalk-project/crosswalk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crosswalk-project/crosswalk/merges","archive_url":"https://api.github.com/repos/crosswalk-project/crosswalk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crosswalk-project/crosswalk/downloads","issues_url":"https://api.github.com/repos/crosswalk-project/crosswalk/issues{/number}","pulls_url":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls{/number}","milestones_url":"https://api.github.com/repos/crosswalk-project/crosswalk/milestones{/number}","notifications_url":"https://api.github.com/repos/crosswalk-project/crosswalk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crosswalk-project/crosswalk/labels{/name}","releases_url":"https://api.github.com/repos/crosswalk-project/crosswalk/releases{/id}","created_at":"2013-04-03T23:30:12Z","updated_at":"2015-02-14T04:04:19Z","pushed_at":"2015-02-13T17:47:24Z","git_url":"git://github.com/crosswalk-project/crosswalk.git","ssh_url":"git@github.com:crosswalk-project/crosswalk.git","clone_url":"https://github.com/crosswalk-project/crosswalk.git","svn_url":"https://github.com/crosswalk-project/crosswalk","homepage":"https://crosswalk-project.org/","size":135037,"stargazers_count":630,"watchers_count":630,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":213,"mirror_url":null,"open_issues_count":110,"forks":213,"open_issues":110,"watchers":630,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853"},"html":{"href":"https://github.com/crosswalk-project/crosswalk/pull/2853"},"issue":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/2853"},"comments":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/issues/2853/comments"},"review_comments":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853/comments"},"review_comment":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/pulls/2853/commits"},"statuses":{"href":"https://api.github.com/repos/crosswalk-project/crosswalk/statuses/e495ac02077301d23387b2634a4121c37a3d207a"}}}}