blob: ef2ce603fa6a4051a53ccf425446afc5095d9a85 [file] [log] [blame]
/*
* Copyright (C) 2011 Samsung Electronics
*
* 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
*/
#include "config.h"
#include "PageClientImpl.h"
#include "DrawingAreaProxyImpl.h"
#include "NativeWebKeyboardEvent.h"
#include "NotImplemented.h"
#include "WebContext.h"
#include "WebContextMenuProxy.h"
#include "WebPageGroup.h"
#include "WebPageProxy.h"
#include "WebPopupMenuProxyEfl.h"
#include "WebPreferences.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
#include "ewk_download_job.h"
#include "ewk_download_job_private.h"
#include "ewk_view.h"
#include "ewk_view_private.h"
using namespace WebCore;
namespace WebKit {
PageClientImpl::PageClientImpl(Evas_Object* viewWidget)
: m_viewWidget(viewWidget)
{
}
PageClientImpl::~PageClientImpl()
{
}
// PageClient
PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
{
return DrawingAreaProxyImpl::create(ewk_view_page_get(m_viewWidget));
}
void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
{
ewk_view_display(m_viewWidget, rect);
}
void PageClientImpl::displayView()
{
notImplemented();
}
void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize&)
{
setViewNeedsDisplay(scrollRect);
}
WebCore::IntSize PageClientImpl::viewSize()
{
return ewk_view_size_get(m_viewWidget);
}
bool PageClientImpl::isViewWindowActive()
{
notImplemented();
return true;
}
bool PageClientImpl::isViewFocused()
{
return evas_object_focus_get(m_viewWidget);
}
bool PageClientImpl::isViewVisible()
{
notImplemented();
return true;
}
bool PageClientImpl::isViewInWindow()
{
notImplemented();
return true;
}
void PageClientImpl::processDidCrash()
{
// Check if loading was ongoing, when web process crashed.
double loadProgress = ewk_view_load_progress_get(m_viewWidget);
if (loadProgress >= 0 && loadProgress < 1)
ewk_view_load_progress_changed(m_viewWidget, 1);
ewk_view_webprocess_crashed(m_viewWidget);
}
void PageClientImpl::didRelaunchProcess()
{
notImplemented();
}
void PageClientImpl::pageClosed()
{
notImplemented();
}
void PageClientImpl::toolTipChanged(const String&, const String&)
{
notImplemented();
}
void PageClientImpl::setCursor(const Cursor& cursor)
{
ewk_view_cursor_set(m_viewWidget, cursor);
}
void PageClientImpl::setCursorHiddenUntilMouseMoves(bool)
{
notImplemented();
}
void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
{
notImplemented();
}
void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo)
{
m_undoController.registerEditCommand(command, undoOrRedo);
}
void PageClientImpl::clearAllEditCommands()
{
m_undoController.clearAllEditCommands();
}
bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
{
return m_undoController.canUndoRedo(undoOrRedo);
}
void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
{
m_undoController.executeUndoRedo(undoOrRedo);
}
FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& viewRect)
{
notImplemented();
return viewRect;
}
FloatRect PageClientImpl::convertToUserSpace(const FloatRect& viewRect)
{
notImplemented();
return viewRect;
}
IntPoint PageClientImpl::screenToWindow(const IntPoint& point)
{
notImplemented();
return point;
}
IntRect PageClientImpl::windowToScreen(const IntRect&)
{
notImplemented();
return IntRect();
}
void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
{
notImplemented();
}
#if ENABLE(TOUCH_EVENTS)
void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent&, bool /*wasEventHandled*/)
{
notImplemented();
}
#endif
PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
{
return WebPopupMenuProxyEfl::create(m_viewWidget, page);
}
PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy*)
{
notImplemented();
return 0;
}
#if ENABLE(INPUT_TYPE_COLOR)
PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&)
{
notImplemented();
return 0;
}
#endif
void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool, bool)
{
notImplemented();
}
#if USE(ACCELERATED_COMPOSITING)
void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext&)
{
ewk_view_accelerated_compositing_mode_enter(m_viewWidget);
}
void PageClientImpl::exitAcceleratedCompositingMode()
{
ewk_view_accelerated_compositing_mode_exit(m_viewWidget);
}
void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&)
{
notImplemented();
}
#endif // USE(ACCELERATED_COMPOSITING)
void PageClientImpl::didChangeScrollbarsForMainFrame() const
{
notImplemented();
}
void PageClientImpl::didCommitLoadForMainFrame(bool)
{
notImplemented();
}
void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const String&, const CoreIPC::DataReference&)
{
notImplemented();
}
double PageClientImpl::customRepresentationZoomFactor()
{
notImplemented();
return 0;
}
void PageClientImpl::setCustomRepresentationZoomFactor(double)
{
notImplemented();
}
void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&)
{
notImplemented();
}
void PageClientImpl::findStringInCustomRepresentation(const String&, FindOptions, unsigned)
{
notImplemented();
}
void PageClientImpl::countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned)
{
notImplemented();
}
void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
{
Ewk_Download_Job* ewkDownload = ewk_download_job_new(download, m_viewWidget);
ewk_context_download_job_add(ewk_view_context_get(m_viewWidget), ewkDownload);
ewk_download_job_unref(ewkDownload);
}
#if USE(TILED_BACKING_STORE)
void PageClientImpl::pageDidRequestScroll(const IntPoint&)
{
notImplemented();
}
#endif
void PageClientImpl::didChangeContentsSize(const WebCore::IntSize& size)
{
ewk_view_contents_size_changed(m_viewWidget, size);
}
} // namespace WebKit