From bf9d2b7fa97f7f41894543b81ddde58997cbc23c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 2 Jul 2016 16:53:48 +0900 Subject: [PATCH] Avoid adding WebContentsAudioMuted method --- brightray/browser/browser_client.h | 11 ++++------- brightray/browser/platform_notification_service.cc | 10 +++------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 21360ba04a..e810a44fad 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -28,13 +28,10 @@ class BrowserClient : public content::ContentBrowserClient { NotificationPresenter* GetNotificationPresenter(); // Subclasses should override this to enable or disable WebNotification. - virtual void WebNotificationAllowed(int render_process_id, - const base::Callback& callback) { - callback.Run(true); - } - - virtual bool WebContentsAudioMuted(int render_process_id) { - return false; + virtual void WebNotificationAllowed( + int render_process_id, + const base::Callback& callback) { + callback.Run(false, true); } // Subclasses that override this (e.g., to provide their own protocol diff --git a/brightray/browser/platform_notification_service.cc b/brightray/browser/platform_notification_service.cc index 873e82df27..7821de440a 100644 --- a/brightray/browser/platform_notification_service.cc +++ b/brightray/browser/platform_notification_service.cc @@ -22,12 +22,12 @@ void RemoveNotification(base::WeakPtr notification) { } void OnWebNotificationAllowed( - int render_process_id, brightray::BrowserClient* browser_client, const SkBitmap& icon, const content::PlatformNotificationData& data, std::unique_ptr delegate, base::Closure* cancel_callback, + bool audio_muted, bool allowed) { if (!allowed) return; @@ -38,12 +38,9 @@ void OnWebNotificationAllowed( new NotificationDelegateAdapter(std::move(delegate))); auto notification = presenter->CreateNotification(adapter.get()); if (notification) { - bool silent = data.silent; - if (!silent) { - silent = browser_client->WebContentsAudioMuted(render_process_id); - } ignore_result(adapter.release()); // it will release itself automatically. - notification->Show(data.title, data.body, data.tag, data.icon, icon, silent); + notification->Show(data.title, data.body, data.tag, data.icon, icon, + audio_muted ? true : data.silent); *cancel_callback = base::Bind(&RemoveNotification, notification); } } @@ -83,7 +80,6 @@ void PlatformNotificationService::DisplayNotification( browser_client_->WebNotificationAllowed( render_process_id_, base::Bind(&OnWebNotificationAllowed, - render_process_id_, browser_client_, notification_resources.notification_icon, notification_data,