This source file includes following definitions.
- respondToChangedSelection
- respondToChangedContents
- canCopyCut
- canPaste
- didExecuteCommand
- handleKeyboardEvent
#include "config.h"
#include "EditorClientImpl.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
#include "WebPermissionClient.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "core/editing/SelectionType.h"
using namespace WebCore;
namespace blink {
EditorClientImpl::EditorClientImpl(WebViewImpl* webview)
: m_webView(webview)
{
}
EditorClientImpl::~EditorClientImpl()
{
}
void EditorClientImpl::respondToChangedSelection(LocalFrame* frame, WebCore::SelectionType selectionType)
{
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
if (webFrame->client())
webFrame->client()->didChangeSelection(selectionType != WebCore::RangeSelection);
}
void EditorClientImpl::respondToChangedContents()
{
if (m_webView->client())
m_webView->client()->didChangeContents();
}
bool EditorClientImpl::canCopyCut(LocalFrame* frame, bool defaultValue) const
{
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
if (!webFrame->permissionClient())
return defaultValue;
return webFrame->permissionClient()->allowWriteToClipboard(webFrame, defaultValue);
}
bool EditorClientImpl::canPaste(LocalFrame* frame, bool defaultValue) const
{
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
if (!webFrame->permissionClient())
return defaultValue;
return webFrame->permissionClient()->allowReadFromClipboard(webFrame, defaultValue);
}
void EditorClientImpl::didExecuteCommand(String commandName)
{
if (m_webView->client())
m_webView->client()->didExecuteCommand(WebString(commandName));
}
bool EditorClientImpl::handleKeyboardEvent()
{
return m_webView->client() && m_webView->client()->handleCurrentKeyboardEvent();
}
}