Avoid adding WebContentsAudioMuted method

This commit is contained in:
Cheng Zhao 2016-07-02 16:53:48 +09:00
parent b217fb07a6
commit bf9d2b7fa9
2 changed files with 7 additions and 14 deletions

View file

@ -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<void(bool)>& callback) {
callback.Run(true);
}
virtual bool WebContentsAudioMuted(int render_process_id) {
return false;
virtual void WebNotificationAllowed(
int render_process_id,
const base::Callback<void(bool, bool)>& callback) {
callback.Run(false, true);
}
// Subclasses that override this (e.g., to provide their own protocol

View file

@ -22,12 +22,12 @@ void RemoveNotification(base::WeakPtr<Notification> notification) {
}
void OnWebNotificationAllowed(
int render_process_id,
brightray::BrowserClient* browser_client,
const SkBitmap& icon,
const content::PlatformNotificationData& data,
std::unique_ptr<content::DesktopNotificationDelegate> 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,