haikuwebkit/Source/WebCore/platform/SystemSoundDelegate.h

38 lines
1.5 KiB
C
Raw Permalink Normal View History

[macOS] System sounds should be played in the UI process https://bugs.webkit.org/show_bug.cgi?id=218405 Source/WebCore: <rdar://problem/70898846> Reviewed by Darin Adler. In preparation of blocking the system sound server in the WebContent process, system sounds should be played in the UI process. This patch creates a system sound manager, which delegates the sound request if a delegate is present, otherwise the function PAL::systemBeep will be called. API test: WebKit.SystemBeep * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * editing/Editor.cpp: (WebCore::Editor::cut): (WebCore::Editor::copy): (WebCore::Editor::performDelete): * editing/EditorCommand.cpp: (WebCore::executeSelectToMark): (WebCore::executeSwapWithMark): * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::takeFindStringFromSelection): * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::beep): * platform/SystemSoundDelegate.h: Added. (WebCore::SystemSoundDelegate::~SystemSoundDelegate): (WebCore::SystemSoundDelegate::systemBeep): * platform/SystemSoundManager.cpp: Added. (WebCore::SystemSoundManager::singleton): (WebCore::SystemSoundManager::setSystemSoundDelegate): (WebCore::SystemSoundManager::systemBeep): * platform/SystemSoundManager.h: Added. * platform/audio/StereoPanner.cpp: * testing/Internals.cpp: (WebCore::Internals::systemBeep): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: <rdar://problem/70898846> Reviewed by Darin Adler. Subclass SystemSoundDelegate, which will forward system sound requests to the UI process. * Sources.txt: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::systemBeep): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebSystemSoundDelegate.cpp: Added. (WebKit::WebSystemSoundDelegate::systemBeep): * WebProcess/WebSystemSoundDelegate.h: Added. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Tools: Reviewed by Darin Adler. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/SystemBeep.mm: Added. (TEST): Canonical link: https://commits.webkit.org/231384@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-09 20:20:06 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
namespace WebCore {
class SystemSoundDelegate {
public:
virtual ~SystemSoundDelegate() { }
virtual void systemBeep() { }
};
} // namespace WebCore