Bring up notifications
authorArnaud Renevier <a.renevier@samsung.com>
Tue, 14 Apr 2015 22:20:24 +0000 (15:20 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Most of the api has been pushed to ContentBrowserClientEfl to an
interface PlatformNotificationService.
https://code.google.com/p/chromium/issues/detail?id=439950

We implement PlatformNotificationService with NotificationControllerEfl

Since embedder API for notifications change a lot on chromium side, we
guard notifications with a compile flag. That way, it will be easier to
disable notifications temporarily if needed next time we update
chromium.

NotificationControllerEfl::SetPermissions is removed because it wasn't
used.

http://107.108.218.239/bugzilla/show_bug.cgi?id=10487

Change-Id: If155b5d5b8c7fc99ebe0ef75a0b5388e849bd1dd
Signed-off-by: Arnaud Renevier <a.renevier@samsung.com>
tizen_src/ewk/efl_integration/browser/notification/notification_controller_efl.cc
tizen_src/ewk/efl_integration/browser/notification/notification_controller_efl.h
tizen_src/ewk/efl_integration/content_browser_client_efl.cc
tizen_src/ewk/efl_integration/content_browser_client_efl.h
tizen_src/ewk/efl_integration/public/ewk_notification.cc
tizen_src/supplement.gypi

index 14472cb..07deb13 100644 (file)
@@ -4,59 +4,70 @@
 
 #include "browser/notification/notification_controller_efl.h"
 
-#include <Eina.h>
-
-#include "eweb_view.h"
+#include "base/strings/utf_string_conversions.h"
 #include "common/web_contents_utils.h"
-#include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/public/browser/web_contents.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/common/platform_notification_data.h"
+#include "eweb_view.h"
 #include "private/ewk_notification_private.h"
-#include "private/ewk_security_origin_private.h"
+#include "public/ewk_notification.h"
 
 using web_contents_utils::WebViewFromWebContents;
 
 namespace content {
 
-NotificationControllerEfl::NotificationControllerEfl() {
+NotificationControllerEfl::NotificationControllerEfl()
+  : notification_show_callback_(nullptr)
+  , notification_cancel_callback_(nullptr)
+  , notification_callback_user_data_(nullptr)
+  , weak_factory_(this)
+{
 }
 
 NotificationControllerEfl::~NotificationControllerEfl() {
-  notification_map.Clear();
+  notifications_map_.Clear();
 }
 
 void NotificationControllerEfl::NotificationAdd(uint64_t notification_id,
-    int render_process_id, const base::string16& replace_id,
+    const GURL& origin, const base::string16& replace_id,
     scoped_ptr<DesktopNotificationDelegate> delegate) {
 
   NotificationData* new_notification(new NotificationData(
-      render_process_id, replace_id, delegate.Pass()));
-  notification_map.AddWithID(new_notification, notification_id);
+      origin, replace_id, delegate.Pass()));
+  notifications_map_.AddWithID(new_notification, notification_id);
 }
 
 bool NotificationControllerEfl::NotificationClosed(uint64_t notification_id,
     bool by_user) {
 
-  NotificationData* saved_data = notification_map.Lookup(notification_id);
+  NotificationData* saved_data = notifications_map_.Lookup(notification_id);
   if (!saved_data)
     return false;
 
   saved_data->notification_delegate->NotificationClosed(by_user);
-  notification_map.Remove(notification_id);
+  notifications_map_.Remove(notification_id);
   return true;
 }
 
+void NotificationControllerEfl::NotificationCancelled(uint64_t notification_id) {
+  NotificationClosed(notification_id, false);
+  if (notification_cancel_callback_) {
+    notification_cancel_callback_(notification_id, notification_callback_user_data_);
+  }
+}
+
 bool NotificationControllerEfl::NotificationClicked(uint64_t notification_id) {
-  NotificationData* saved_data = notification_map.Lookup(notification_id);
+  NotificationData* saved_data = notifications_map_.Lookup(notification_id);
   if (!saved_data)
     return false;
 
   saved_data->notification_delegate->NotificationClick();
-  notification_map.Remove(notification_id);
+  notifications_map_.Remove(notification_id);
   return true;
 }
 
 bool NotificationControllerEfl::NotificationDisplayed(uint64_t notification_id) {
-  NotificationData* saved_data = notification_map.Lookup(notification_id);
+  NotificationData* saved_data = notifications_map_.Lookup(notification_id);
   if (!saved_data)
     return false;
 
@@ -64,6 +75,79 @@ bool NotificationControllerEfl::NotificationDisplayed(uint64_t notification_id)
   return true;
 }
 
+blink::WebNotificationPermission NotificationControllerEfl::CheckPermissionOnUIThread(
+    BrowserContext* browser_context,
+    const GURL& origin,
+    int render_process_id) {
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  return CheckPermissionForOrigin(origin);
+}
+
+blink::WebNotificationPermission NotificationControllerEfl::CheckPermissionOnIOThread(
+    ResourceContext* resource_context,
+    const GURL& origin,
+    int render_process_id) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+  return CheckPermissionForOrigin(origin);
+}
+
+void NotificationControllerEfl::DisplayNotification(
+    BrowserContext* browser_context,
+    const GURL& origin,
+    const SkBitmap& icon,
+    const PlatformNotificationData& notification_data,
+    scoped_ptr<DesktopNotificationDelegate> delegate,
+    base::Closure* cancel_callback) {
+
+  if (!notification_show_callback_) {
+    delegate->NotificationClosed(false);
+    return;
+  }
+
+  uint64_t replaceUniqueId = 0;
+  if (!notification_data.tag.empty() &&
+      IsNotificationPresent(origin, notification_data.tag, replaceUniqueId)) {
+    NotificationCancelled(replaceUniqueId);
+  }
+
+  uint64_t notificationUniqueId = reinterpret_cast<uint64_t>(delegate.get());
+  NotificationAdd(notificationUniqueId, origin, notification_data.tag, delegate.Pass());
+
+  if (cancel_callback)
+    *cancel_callback =
+        base::Bind(&NotificationControllerEfl::NotificationCancelled,
+                   weak_factory_.GetWeakPtr(),
+                   notificationUniqueId);
+
+
+  Ewk_Notification* notification =
+      new Ewk_Notification(base::UTF16ToUTF8(notification_data.body),
+                           base::UTF16ToUTF8(notification_data.tag),
+                           base::UTF16ToUTF8(notification_data.title),
+                           icon,
+                           notificationUniqueId,
+                           origin);
+
+  notification_show_callback_(notification, notification_callback_user_data_);
+  delete notification;
+}
+
+void NotificationControllerEfl:: DisplayPersistentNotification(
+    BrowserContext* browser_context,
+    int64 service_worker_registration_id,
+    const GURL& origin,
+    const SkBitmap& icon,
+    const PlatformNotificationData& notification_data) {
+  NOTIMPLEMENTED();
+}
+
+void NotificationControllerEfl::ClosePersistentNotification(
+    BrowserContext* browser_context,
+    const std::string& persistent_notification_id) {
+  NOTIMPLEMENTED();
+}
+
+
 void NotificationControllerEfl::SetPermissionForNotification(
     Ewk_Notification_Permission_Request* notification, bool isAllowed) {
 
@@ -81,16 +165,6 @@ void NotificationControllerEfl::SetPermissionForNotification(
   }
 }
 
-void NotificationControllerEfl::SetPermissions(
-    const std::map<const char*, Eina_Bool>& permissions) {
-  base::AutoLock locker(permissions_mutex_);
-  permissions_map_.clear();
-  std::map<const char*, Eina_Bool>::const_iterator it = permissions.begin();
-  for (; it != permissions.end(); ++it) {
-    permissions_map_[GURL(it->first)] = (it->second == EINA_TRUE);
-  }
-}
-
 void NotificationControllerEfl::AddPermission(const GURL origin,
                                               bool allowed) {
   base::AutoLock locker(permissions_mutex_);
@@ -124,13 +198,12 @@ void NotificationControllerEfl::RemovePermissions(Eina_List* origins) {
   }
 }
 
-bool NotificationControllerEfl::IsNotificationPresent(int render_process_id,
+bool NotificationControllerEfl::IsNotificationPresent(const GURL& origin,
     const base::string16& replaceid, uint64_t& notification_id) {
-
-  IDMap<NotificationData, IDMapOwnPointer>::const_iterator it(&notification_map);
+  IDMap<NotificationData, IDMapOwnPointer>::const_iterator it(&notifications_map_);
   for (; !it.IsAtEnd(); it.Advance()) {
     if (replaceid == it.GetCurrentValue()->replace_id &&
-        render_process_id == it.GetCurrentValue()->render_process_id) {
+        origin.spec() == it.GetCurrentValue()->origin_url) {
       notification_id = it.GetCurrentKey();
       return true;
     }
@@ -145,14 +218,6 @@ void NotificationControllerEfl::RequestPermission(
     const base::Callback<void(bool)>& result_callback) {
   const bool kDefaultResponse = false;
 
-  WebContentsDelegate* delegate = web_contents->GetDelegate();
-  if (!delegate) {
-    LOG(ERROR) << "Dropping PermissionNotification request caused by lack "
-                  "of the WebContents delegate";
-    result_callback.Run(kDefaultResponse);
-    return;
-  }
-
   EWebView* web_view = WebViewFromWebContents(web_contents);
   if (!web_view) {
     LOG(ERROR) << "Dropping PermissionNotification request caused by lack "
@@ -187,4 +252,11 @@ void NotificationControllerEfl::RequestPermission(
   }
 }
 
+void NotificationControllerEfl::SetNotificationCallbacks(Ewk_Notification_Show_Callback show_callback, Ewk_Notification_Cancel_Callback cancel_callback, void* user_data) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  notification_show_callback_ = show_callback;
+  notification_cancel_callback_ = cancel_callback;
+  notification_callback_user_data_ = user_data;
+}
+
 }//namespace
index 5e27f9e..a8d2782 100644 (file)
@@ -8,48 +8,46 @@
 #include <map>
 
 #include <Eina.h>
-#include <Evas.h>
 
-#include "base/callback.h"
 #include "base/id_map.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/strings/utf_string_conversions.h"
-#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
+#include "base/memory/weak_ptr.h"
+#include "base/synchronization/lock.h"
+#include "content/public/browser/desktop_notification_delegate.h"
+#include "content/public/browser/platform_notification_service.h"
+#include "public/ewk_notification.h"
 #include "url/gurl.h"
 
-class Ewk_Notification_Permission_Request;
-
 namespace content {
-class DesktopNotificationDelegate;
-
 class WebContents;
 
 struct NotificationData {
-  int render_process_id;
+  const std::string origin_url;
   const base::string16 replace_id;
   scoped_ptr<DesktopNotificationDelegate> notification_delegate;
 
-  NotificationData(int render_process_id, const base::string16& replaceid,
+  NotificationData(const GURL& origin, const base::string16& replaceid,
       scoped_ptr<DesktopNotificationDelegate> delegate)
-      : render_process_id(render_process_id)
+      : origin_url(origin.spec())
       , replace_id(replaceid)
       , notification_delegate(delegate.Pass()) {
   }
 };
 
-class NotificationControllerEfl {
+class NotificationControllerEfl: public PlatformNotificationService {
  public:
   NotificationControllerEfl();
   ~NotificationControllerEfl();
 
   // Adds a new notification received from engine to a list
-  void NotificationAdd(uint64_t notification_id, int render_process_id,
+  void NotificationAdd(uint64_t notification_id, const GURL& origin,
       const base::string16& replace_id,
       scoped_ptr<DesktopNotificationDelegate> delegate);
 
   bool NotificationClosed(uint64_t notification_id, bool by_user);
 
+  void NotificationCancelled(uint64_t notification_id);
+
   // Notify engine when user clicked on the notification
   bool NotificationClicked(uint64_t notification_id);
 
@@ -61,16 +59,9 @@ class NotificationControllerEfl {
       Ewk_Notification_Permission_Request* notification,
       bool isAllowed);
 
-  // Sets the permissions for given origins
-  void SetPermissions(const std::map<const char*, Eina_Bool> &permissions);
-
   // Adds permission to map
   void AddPermission(const GURL origin, bool allowed);
 
-  // Checks stored permission for given origin
-  blink::WebNotificationPermission CheckPermissionForOrigin(
-      const GURL& origin) const;
-
   // Removes all stored permissions
   void ClearPermissions();
 
@@ -79,23 +70,75 @@ class NotificationControllerEfl {
 
   // Checks if the notification is already present.
   // If present returns the notification id of the notification else false
-  bool IsNotificationPresent(int render_process_id,
+  bool IsNotificationPresent(const GURL& origin,
       const base::string16& replaceid, uint64_t& notification_id);
 
-
   void RequestPermission(WebContents* web_contents,
                          const GURL& requesting_frame,
                          const base::Callback<void(bool)>& result_callback);
 
+  void SetNotificationCallbacks(Ewk_Notification_Show_Callback show_callback,
+      Ewk_Notification_Cancel_Callback close_callback, void* user_data);
+
+  /* PlatformNotificationService */
+  blink::WebNotificationPermission CheckPermissionOnUIThread(
+      BrowserContext* browser_context, const GURL& origin,
+      int render_process_id) override;
+
+  // Checks if |origin| has permission to display Web Notifications. This method
+  // exists to serve the synchronous IPC required by the Notification.permission
+  // JavaScript getter, and should not be used for other purposes. See
+  // https://crbug.com/446497 for the plan to deprecate this method.
+  // This method must only be called on the IO thread.
+  blink::WebNotificationPermission CheckPermissionOnIOThread(
+      ResourceContext* resource_context,
+      const GURL& origin,
+      int render_process_id) override;
+
+  // Displays the notification described in |params| to the user. A closure
+  // through which the notification can be closed will be stored in the
+  // |cancel_callback| argument. This method must be called on the UI thread.
+  void DisplayNotification(
+      BrowserContext* browser_context,
+      const GURL& origin,
+      const SkBitmap& icon,
+      const PlatformNotificationData& notification_data,
+      scoped_ptr<DesktopNotificationDelegate> delegate,
+      base::Closure* cancel_callback) override;
+
+  // Displays the persistent notification described in |notification_data| to
+  // the user. This method must be called on the UI thread.
+  void DisplayPersistentNotification(
+      BrowserContext* browser_context,
+      int64 service_worker_registration_id,
+      const GURL& origin,
+      const SkBitmap& icon,
+      const PlatformNotificationData& notification_data) override;
+
+  // Closes the persistent notification identified by
+  // |persistent_notification_id|. This method must be called on the UI thread.
+  void ClosePersistentNotification(
+      BrowserContext* browser_context,
+      const std::string& persistent_notification_id) override;
+
+
  private:
-  IDMap<NotificationData, IDMapOwnPointer> notification_map; // This stores the notifications displayed to the user
+  blink::WebNotificationPermission CheckPermissionForOrigin(
+      const GURL &origin) const;
+
+  IDMap<NotificationData, IDMapOwnPointer> notifications_map_; // This stores the notifications displayed to the user
   std::map<GURL, bool> permissions_map_;
   mutable base::Lock permissions_mutex_;
 
+  Ewk_Notification_Show_Callback notification_show_callback_;
+  Ewk_Notification_Cancel_Callback notification_cancel_callback_;
+  void* notification_callback_user_data_;
+
+  base::WeakPtrFactory<NotificationControllerEfl> weak_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(NotificationControllerEfl);
 };
 
 } //namespace
 
 #endif // NOTIFICATION_CONTROLLER_EFL_H
-
index d05a207..ff703b7 100644 (file)
@@ -35,7 +35,7 @@
 #include "content/browser/speech/tts_message_filter_efl.h"
 #endif
 
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
 #include "browser/notification/notification_controller_efl.h"
 #endif
 
@@ -50,12 +50,9 @@ namespace content {
 
 ContentBrowserClientEfl::ContentBrowserClientEfl()
   : browser_main_parts_efl_(nullptr)
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   , notification_controller_(new NotificationControllerEfl)
 #endif
-  , notification_show_callback_(nullptr)
-  , notification_cancel_callback_(nullptr)
-  , notification_callback_user_data_(nullptr)
 {
 }
 
@@ -178,53 +175,13 @@ void ContentBrowserClientEfl::AllowCertificateError(
          resource_type, overridable, strict_enforcement, callback, result);
 }
 
-#if !defined(EWK_BRINGUP)
-blink::WebNotificationPermission
-    ContentBrowserClientEfl::CheckDesktopNotificationPermission(
-        const GURL& source_url,
-        ResourceContext* context,
-        int) {
-  return notification_controller_->CheckPermissionForOrigin(
-      source_url.GetOrigin());
+#if defined(ENABLE_NOTIFICATIONS)
+PlatformNotificationService* ContentBrowserClientEfl::GetPlatformNotificationService() {
+  return notification_controller_.get();
 }
 
-void ContentBrowserClientEfl::ShowDesktopNotification(
-      const content::ShowDesktopNotificationHostMsgParams& params,
-      BrowserContext* browser_context,
-      int render_process_id,
-      scoped_ptr<DesktopNotificationDelegate> delegate,
-      base::Closure* cancel_callback) {
-  if (!notification_show_callback_) {
-    delegate->NotificationClosed(false);
-    return;
-  }
-
-  uint64_t replaceUniqueId = 0;
-  if (!params.replace_id.empty() &&
-      notification_controller_->IsNotificationPresent(render_process_id,
-          params.replace_id, replaceUniqueId)) {
-
-    notification_controller_->NotificationClosed(replaceUniqueId, false);
-    // notify embeder that notification should be closed
-    if (notification_cancel_callback_) {
-      notification_cancel_callback_(replaceUniqueId, notification_callback_user_data_);
-    }
-  }
-
-  uint64_t notificationUniqueId = reinterpret_cast<uint64_t>(delegate.get());
-  notification_controller_->NotificationAdd(notificationUniqueId,
-      render_process_id, params.replace_id, delegate.Pass());
-
-  Ewk_Notification* notification =
-      new Ewk_Notification(base::UTF16ToUTF8(params.body),
-                           base::UTF16ToUTF8(params.replace_id),
-                           base::UTF16ToUTF8(params.title),
-                           params.icon,
-                           notificationUniqueId,
-                           params.origin);
-
-  notification_show_callback_(notification, notification_callback_user_data_);
-  delete notification;
+NotificationControllerEfl* ContentBrowserClientEfl::GetNotificationController() const {
+  return notification_controller_.get();
 }
 #endif
 
@@ -352,7 +309,7 @@ void ContentBrowserClientEfl::RequestPermission(
     }
     case content::PERMISSION_NOTIFICATIONS:
     {
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
       notification_controller_->RequestPermission(web_contents,
                                                  requesting_frame,
                                                  result_callback);
@@ -426,13 +383,6 @@ std::string ContentBrowserClientEfl::GetApplicationLocale() {
   return locale;
 }
 
-void ContentBrowserClientEfl::SetNotificationCallbacks(Notification_Show_Callback show_callback, Notification_Cancel_Callback cancel_callback, void* user_data) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  notification_show_callback_ = show_callback;
-  notification_cancel_callback_ = cancel_callback;
-  notification_callback_user_data_ = user_data;
-}
-
 WebContentsViewDelegate* ContentBrowserClientEfl::GetWebContentsViewDelegate(
     WebContents* web_contents) {
   return new WebContentsViewDelegateEwk(WebViewFromWebContents(web_contents));
index 34f20eb..f3dbcd1 100644 (file)
@@ -16,10 +16,12 @@ class Ewk_Notification;
 
 namespace content {
 class BrowserMainPartsEfl;
+#if defined(ENABLE_NOTIFICATIONS)
 class NotificationControllerEfl;
+#endif
 class ResourceDispatcherHostDelegateEfl;
 class WebContents;
-struct ShowDesktopNotificationHostMsgParams;
+class WebContentsView;
 
 class ContentBrowserClientEfl: public ContentBrowserClient {
  public:
@@ -75,21 +77,10 @@ class ContentBrowserClientEfl: public ContentBrowserClient {
                                      const base::Callback<void(bool)>& callback,
                                      CertificateRequestResultType* result) override;
 
-#if !defined(EWK_BRINGUP)
-  blink::WebNotificationPermission
-      CheckDesktopNotificationPermission(
-          const GURL& source_url,
-          ResourceContext* context,
-          int render_process_id) override;
-
-  // Show a desktop notification.  If |worker| is true, the request came from an
-  // HTML5 web worker, otherwise, it came from a renderer.
-  virtual void ShowDesktopNotification(
-      const content::ShowDesktopNotificationHostMsgParams& params,
-      BrowserContext* browser_context,
-      int render_process_id,
-      scoped_ptr<DesktopNotificationDelegate> delegate,
-      base::Closure* cancel_callback) override;
+#if defined(ENABLE_NOTIFICATIONS)
+  virtual PlatformNotificationService* GetPlatformNotificationService() override;
+
+  NotificationControllerEfl* GetNotificationController() const;
 #endif
 
   virtual bool AllowGetCookie(const GURL& url,
@@ -128,15 +119,6 @@ class ContentBrowserClientEfl: public ContentBrowserClient {
 
   std::string GetApplicationLocale() override;
 
-  void SetNotificationCallbacks(Notification_Show_Callback show_callback,
-      Notification_Cancel_Callback close_callback, void* user_data);
-
-#if !defined(EWK_BRINGUP)
-  NotificationControllerEfl* GetNotificationController() const {
-    return notification_controller_.get();
-  }
-#endif
-
   WebContentsViewDelegate* GetWebContentsViewDelegate(
       WebContents* web_contents) override;
 
@@ -148,12 +130,9 @@ class ContentBrowserClientEfl: public ContentBrowserClient {
 
   scoped_ptr<ResourceDispatcherHostDelegateEfl> resource_disp_host_del_efl_;
   BrowserMainPartsEfl* browser_main_parts_efl_;
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   scoped_ptr<NotificationControllerEfl> notification_controller_;
 #endif
-  Notification_Show_Callback notification_show_callback_;
-  Notification_Cancel_Callback notification_cancel_callback_;
-  void* notification_callback_user_data_;
 
   DISALLOW_COPY_AND_ASSIGN(ContentBrowserClientEfl);
 };
index b127ab8..9fdf602 100644 (file)
@@ -11,7 +11,7 @@
 #include "eweb_view.h"
 #include "ewk_global_data.h"
 #include "browser_context_efl.h"
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
 #include "browser/notification/notification_controller_efl.h"
 #endif
 #include "private/ewk_context_private.h"
@@ -43,8 +43,8 @@ Eina_Bool ewk_notification_callbacks_set(Ewk_Notification_Show_Callback show_cal
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
 
-#if !defined(EWK_BRINGUP)
-  cbce->SetNotificationCallbacks(show_callback, cancel_callback, user_data);
+#if defined(ENABLE_NOTIFICATIONS)
+  cbce->GetNotificationController()->SetNotificationCallbacks(show_callback, cancel_callback, user_data);
 #endif
 
   return EINA_TRUE;
@@ -55,8 +55,8 @@ Eina_Bool ewk_notification_callbacks_reset()
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
 
-#if !defined(EWK_BRINGUP)
-  cbce->SetNotificationCallbacks(nullptr, nullptr, nullptr);
+#if defined(ENABLE_NOTIFICATIONS)
+  cbce->GetNotificationController()->SetNotificationCallbacks(nullptr, nullptr, nullptr);
 #endif
   return EINA_TRUE;
 }
@@ -78,7 +78,7 @@ Eina_Bool ewk_notification_clicked(uint64_t notification_id)
 {
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   return cbce->GetNotificationController()->NotificationClicked(notification_id);
 #else
   return EINA_FALSE;
@@ -100,7 +100,7 @@ Eina_Bool ewk_notification_cached_permissions_set(Eina_List* ewk_notification_pe
 {
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   content::NotificationControllerEfl* notification_controller = cbce->GetNotificationController();
   notification_controller->ClearPermissions();
   Eina_List* list;
@@ -124,7 +124,7 @@ const Ewk_Security_Origin* ewk_notification_permission_request_origin_get(
 Eina_Bool ewk_notification_permission_reply(Ewk_Notification_Permission_Request* request, Eina_Bool allow)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(request, EINA_FALSE);
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
   cbce->GetNotificationController()->SetPermissionForNotification(request, allow);
@@ -146,7 +146,7 @@ Eina_Bool ewk_notification_permission_request_suspend(Ewk_Notification_Permissio
 Eina_Bool ewk_notification_policies_removed(Eina_List* origins)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(origins, EINA_FALSE);
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
   cbce->GetNotificationController()->RemovePermissions(origins);
@@ -162,7 +162,7 @@ const Ewk_Security_Origin* ewk_notification_security_origin_get(const Ewk_Notifi
 
 Eina_Bool ewk_notification_showed(Ewk_Context*, uint64_t notification_id)
 {
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
   return cbce->GetNotificationController()->NotificationDisplayed(notification_id);
@@ -173,7 +173,7 @@ Eina_Bool ewk_notification_showed(Ewk_Context*, uint64_t notification_id)
 
 Eina_Bool ewk_notification_closed(uint64_t notification_id, Eina_Bool by_user)
 {
-#if !defined(EWK_BRINGUP)
+#if defined(ENABLE_NOTIFICATIONS)
   ContentBrowserClientEfl* cbce = GetContentBrowserClient();
   EINA_SAFETY_ON_NULL_RETURN_VAL(cbce, EINA_FALSE);
   return cbce->GetNotificationController()->NotificationClosed(notification_id, by_user);
index a379bd1..ec7ff03 100644 (file)
@@ -29,8 +29,6 @@
     'chromium_efl_tizen_version%': '2.4',
 
     'grit_additional_defines': [ '-D', 'use_aura' ],
-
-    'notifications': 0,
   },
 
   'includes': [