Skip to content

Commit 49ac688

Browse files
committed
chrome: Implement CefBrowserHost::SetAudioMuted/IsAudioMuted (fixes #3893)
1 parent 8cf3084 commit 49ac688

6 files changed

+24
-36
lines changed

libcef/browser/alloy/alloy_browser_host_impl.cc

-23
Original file line numberDiff line numberDiff line change
@@ -901,29 +901,6 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
901901
}
902902
}
903903

904-
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
905-
if (!CEF_CURRENTLY_ON_UIT()) {
906-
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
907-
this, mute));
908-
return;
909-
}
910-
if (!web_contents()) {
911-
return;
912-
}
913-
web_contents()->SetAudioMuted(mute);
914-
}
915-
916-
bool AlloyBrowserHostImpl::IsAudioMuted() {
917-
if (!CEF_CURRENTLY_ON_UIT()) {
918-
DCHECK(false) << "called on invalid thread";
919-
return false;
920-
}
921-
if (!web_contents()) {
922-
return false;
923-
}
924-
return web_contents()->IsAudioMuted();
925-
}
926-
927904
// content::WebContentsDelegate methods.
928905
// -----------------------------------------------------------------------------
929906

libcef/browser/alloy/alloy_browser_host_impl.h

-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
115115
void DragTargetDrop(const CefMouseEvent& event) override;
116116
void DragSourceSystemDragEnded() override;
117117
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
118-
void SetAudioMuted(bool mute) override;
119-
bool IsAudioMuted() override;
120118
void SetAutoResizeEnabled(bool enabled,
121119
const CefSize& min_size,
122120
const CefSize& max_size) override;

libcef/browser/browser_host_base.cc

+22
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,28 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry() {
783783
return new CefNavigationEntryImpl(entry);
784784
}
785785

786+
void CefBrowserHostBase::SetAudioMuted(bool mute) {
787+
if (!CEF_CURRENTLY_ON_UIT()) {
788+
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetAudioMuted,
789+
this, mute));
790+
return;
791+
}
792+
if (auto web_contents = GetWebContents()) {
793+
web_contents->SetAudioMuted(mute);
794+
}
795+
}
796+
797+
bool CefBrowserHostBase::IsAudioMuted() {
798+
if (!CEF_CURRENTLY_ON_UIT()) {
799+
DCHECK(false) << "called on invalid thread";
800+
return false;
801+
}
802+
if (auto web_contents = GetWebContents()) {
803+
return web_contents->IsAudioMuted();
804+
}
805+
return false;
806+
}
807+
786808
void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
787809
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
788810
if (!CEF_CURRENTLY_ON_UIT()) {

libcef/browser/browser_host_base.h

+2
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ class CefBrowserHostBase : public CefBrowserHost,
262262
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
263263
bool current_only) override;
264264
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
265+
void SetAudioMuted(bool mute) override;
266+
bool IsAudioMuted() override;
265267
void NotifyMoveOrResizeStarted() override;
266268
bool IsFullscreen() override;
267269
void ExitFullscreen(bool will_cause_resize) override;

libcef/browser/chrome/chrome_browser_host_impl.cc

-9
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,6 @@ void ChromeBrowserHostImpl::DragSourceEndedAt(int x,
327327
NOTIMPLEMENTED();
328328
}
329329

330-
void ChromeBrowserHostImpl::SetAudioMuted(bool mute) {
331-
NOTIMPLEMENTED();
332-
}
333-
334-
bool ChromeBrowserHostImpl::IsAudioMuted() {
335-
NOTIMPLEMENTED();
336-
return false;
337-
}
338-
339330
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
340331
const CefSize& min_size,
341332
const CefSize& max_size) {

libcef/browser/chrome/chrome_browser_host_impl.h

-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
109109
void DragTargetDrop(const CefMouseEvent& event) override;
110110
void DragSourceSystemDragEnded() override;
111111
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
112-
void SetAudioMuted(bool mute) override;
113-
bool IsAudioMuted() override;
114112
void SetAutoResizeEnabled(bool enabled,
115113
const CefSize& min_size,
116114
const CefSize& max_size) override;

0 commit comments

Comments
 (0)