2 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008 Collabora Ltd. All rights reserved.
6 * Copyright (C) 2008 Holger Hans Peter Freyther
7 * Copyright (C) 2008 Kenneth Rohde Christiansen
8 * Copyright (C) 2009-2010 ProFUSION embedded systems
9 * Copyright (C) 2009-2010 Samsung Electronics
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
23 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include "FrameLoaderClientEfl.h"
39 #include "DocumentLoader.h"
41 #include "FormState.h"
42 #include "FrameLoader.h"
43 #include "FrameNetworkingContextEfl.h"
44 #include "FrameTree.h"
45 #include "FrameView.h"
46 #include "HTMLFormElement.h"
47 #include "MIMETypeRegistry.h"
48 #include "NotImplemented.h"
50 #include "PluginDatabase.h"
51 #include "ProgressTracker.h"
52 #include "RenderPart.h"
53 #include "ResourceRequest.h"
54 #include "WebKitVersion.h"
55 #include "ewk_private.h"
56 #include <wtf/text/CString.h>
57 #include <wtf/text/StringConcatenate.h>
60 #include <sys/utsname.h>
62 #include "SystemInfo.h"
65 #include <Ecore_Evas.h>
67 using namespace WebCore;
71 FrameLoaderClientEfl::FrameLoaderClientEfl(Evas_Object *view)
75 , m_customUserAgent("")
77 , m_hasSentResponseToPlugin(false)
78 , m_hasRepresentation(false)
82 static String agentOS()
86 return "Intel Mac OS X";
88 return "PPC Mac OS X";
92 if (uname(&name) != -1)
93 return makeString(name.sysname, ' ', name.machine);
97 return windowsVersionForUAString();
104 static String composeUserAgent()
106 String webKitVersion = String::format("%d.%d", WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION);
107 return makeString("Mozilla/5.0 (", agentOS(), ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) Safari/", webKitVersion);
110 void FrameLoaderClientEfl::setCustomUserAgent(const String &agent)
112 m_customUserAgent = agent;
115 const String& FrameLoaderClientEfl::customUserAgent() const
117 return m_customUserAgent;
120 String FrameLoaderClientEfl::userAgent(const KURL&)
122 if (!m_customUserAgent.isEmpty())
123 return m_customUserAgent;
125 if (m_userAgent.isEmpty())
126 m_userAgent = composeUserAgent();
130 void FrameLoaderClientEfl::callPolicyFunction(FramePolicyFunction function, PolicyAction action)
132 Frame* f = ewk_frame_core_get(m_frame);
134 (f->loader()->policyChecker()->*function)(action);
137 WTF::PassRefPtr<DocumentLoader> FrameLoaderClientEfl::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
139 RefPtr<DocumentLoader> loader = DocumentLoader::create(request, substituteData);
140 if (substituteData.isValid())
141 loader->setDeferMainResourceDataLoad(false);
142 return loader.release();
145 void FrameLoaderClientEfl::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
147 // FIXME: This is surely too simple
149 callPolicyFunction(function, PolicyUse);
152 void FrameLoaderClientEfl::committedLoad(DocumentLoader* loader, const char* data, int length)
155 loader->commitData(data, length);
157 // We re-check here as the plugin can have been created
159 if (!m_hasSentResponseToPlugin) {
160 m_pluginView->didReceiveResponse(loader->response());
161 m_hasSentResponseToPlugin = true;
163 m_pluginView->didReceiveData(data, length);
167 void FrameLoaderClientEfl::dispatchDidReplaceStateWithinPage()
172 void FrameLoaderClientEfl::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
177 void FrameLoaderClientEfl::dispatchDidPushStateWithinPage()
182 void FrameLoaderClientEfl::dispatchDidPopStateWithinPage()
187 void FrameLoaderClientEfl::dispatchDidChangeBackForwardIndex() const
192 void FrameLoaderClientEfl::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
197 void FrameLoaderClientEfl::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
202 void FrameLoaderClientEfl::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
207 void FrameLoaderClientEfl::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& coreRequest, const ResourceResponse& coreResponse)
209 CString url = coreRequest.url().string().utf8();
210 DBG("Resource url=%s", url.data());
212 Ewk_Frame_Resource_Request request = { 0, identifier };
213 Ewk_Frame_Resource_Request orig = request; /* Initialize const fields. */
215 orig.url = request.url = url.data();
217 ewk_frame_request_will_send(m_frame, &request);
219 if (request.url != orig.url) {
220 coreRequest.setURL(KURL(KURL(), request.url));
222 // Calling client might have changed our url pointer.
223 // Free the new allocated string.
224 free(const_cast<char*>(request.url));
228 bool FrameLoaderClientEfl::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
234 void FrameLoaderClientEfl::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest& coreRequest)
236 CString url = coreRequest.url().string().utf8();
237 DBG("Resource url=%s", url.data());
239 Ewk_Frame_Resource_Request request = { 0, identifier };
240 ewk_frame_request_assign_identifier(m_frame, &request);
243 void FrameLoaderClientEfl::postProgressStartedNotification()
245 ewk_frame_load_started(m_frame);
246 postProgressEstimateChangedNotification();
249 void FrameLoaderClientEfl::postProgressEstimateChangedNotification()
251 ewk_frame_load_progress_changed(m_frame);
254 void FrameLoaderClientEfl::postProgressFinishedNotification()
256 if (m_loadError.isNull())
257 ewk_frame_load_finished(m_frame, 0, 0, 0, 0, 0);
259 ewk_frame_load_finished(m_frame,
260 m_loadError.domain().utf8().data(),
261 m_loadError.errorCode(),
262 m_loadError.isCancellation(),
263 m_loadError.localizedDescription().utf8().data(),
264 m_loadError.failingURL().utf8().data());
268 void FrameLoaderClientEfl::frameLoaderDestroyed()
271 ewk_frame_core_gone(m_frame);
277 void FrameLoaderClientEfl::dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse& response)
279 m_response = response;
282 void FrameLoaderClientEfl::dispatchDecidePolicyForResponse(FramePolicyFunction function, const ResourceResponse& response, const ResourceRequest& resourceRequest)
284 // we need to call directly here (currently callPolicyFunction does that!)
287 if (resourceRequest.isNull()) {
288 callPolicyFunction(function, PolicyIgnore);
292 if (canShowMIMEType(response.mimeType()))
293 callPolicyFunction(function, PolicyUse);
295 callPolicyFunction(function, PolicyDownload);
298 void FrameLoaderClientEfl::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>, const String&)
303 if (resourceRequest.isNull()) {
304 callPolicyFunction(function, PolicyIgnore);
308 // if not acceptNavigationRequest - look at Qt -> PolicyIgnore;
309 // FIXME: do proper check and only reset forms when on PolicyIgnore
310 Frame* f = ewk_frame_core_get(m_frame);
311 f->loader()->resetMultipleFormSubmissionProtection();
312 callPolicyFunction(function, PolicyUse);
315 void FrameLoaderClientEfl::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>)
320 if (resourceRequest.isNull()) {
321 callPolicyFunction(function, PolicyIgnore);
325 // if not acceptNavigationRequest - look at Qt -> PolicyIgnore;
326 // FIXME: do proper check and only reset forms when on PolicyIgnore
327 char* url = strdup(resourceRequest.url().string().utf8().data());
328 Ewk_Frame_Resource_Request request = { url, 0 };
329 Eina_Bool ret = ewk_view_navigation_policy_decision(m_view, &request);
334 policy = PolicyIgnore;
336 if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted) {
337 Frame* f = ewk_frame_core_get(m_frame);
338 f->loader()->resetMultipleFormSubmissionProtection();
342 callPolicyFunction(function, policy);
345 PassRefPtr<Widget> FrameLoaderClientEfl::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
350 return ewk_view_plugin_create(m_view, m_frame, pluginSize,
351 element, url, paramNames, paramValues,
352 mimeType, loadManually);
355 PassRefPtr<Frame> FrameLoaderClientEfl::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
360 return ewk_view_frame_create(m_view, m_frame, name, ownerElement, url, referrer);
363 void FrameLoaderClientEfl::didTransferChildFrameToNewDocument(Page*)
367 Frame* currentFrame = ewk_frame_core_get(m_frame);
368 Evas_Object* currentView = ewk_frame_view_get(m_frame);
369 Frame* parentFrame = currentFrame->tree()->parent();
371 FrameLoaderClientEfl* client = static_cast<FrameLoaderClientEfl*>(parentFrame->loader()->client());
372 Evas_Object* clientFrame = client ? client->webFrame() : 0;
373 Evas_Object* clientView = ewk_frame_view_get(clientFrame);
375 if (currentView != clientView) {
376 ewk_frame_view_set(m_frame, clientView);
380 ASSERT(ewk_view_core_page_get(ewk_frame_view_get(m_frame)) == currentFrame->page());
383 void FrameLoaderClientEfl::transferLoadingResourceFromPage(ResourceLoader*, const ResourceRequest&, Page*)
387 void FrameLoaderClientEfl::redirectDataToPlugin(Widget* pluginWidget)
389 ASSERT(!m_pluginView);
390 m_pluginView = static_cast<PluginView*>(pluginWidget);
391 m_hasSentResponseToPlugin = false;
394 PassRefPtr<Widget> FrameLoaderClientEfl::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
395 const Vector<String>& paramNames, const Vector<String>& paramValues)
401 ObjectContentType FrameLoaderClientEfl::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages)
403 // FIXME: once plugin support is enabled, this method needs to correctly handle the 'shouldPreferPlugInsForImages' flag. See
404 // WebCore::FrameLoader::defaultObjectContentType() for an example.
405 UNUSED_PARAM(shouldPreferPlugInsForImages);
407 if (url.isEmpty() && mimeType.isEmpty())
408 return ObjectContentNone;
410 // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure
411 String type = mimeType;
413 type = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1));
416 return ObjectContentFrame;
418 if (MIMETypeRegistry::isSupportedImageMIMEType(type))
419 return ObjectContentImage;
421 #if 0 // PluginDatabase is disabled until we have Plugin system done.
422 if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType))
423 return ObjectContentNetscapePlugin;
426 if (MIMETypeRegistry::isSupportedNonImageMIMEType(type))
427 return ObjectContentFrame;
429 if (url.protocol() == "about")
430 return ObjectContentFrame;
432 return ObjectContentNone;
435 String FrameLoaderClientEfl::overrideMediaType() const
441 void FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
443 if (world != mainThreadNormalWorld())
446 Frame* coreFrame = ewk_frame_core_get(m_frame);
449 Settings* settings = coreFrame->settings();
450 if (!settings || !settings->isJavaScriptEnabled())
453 Ewk_Window_Object_Cleared_Event event;
454 event.context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
455 event.windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld()));
456 event.frame = m_frame;
458 evas_object_smart_callback_call(m_view, "window,object,cleared", &event);
460 #if ENABLE(NETSCAPE_PLUGIN_API)
461 ewk_view_js_window_object_clear(m_view, m_frame);
465 void FrameLoaderClientEfl::documentElementAvailable()
470 void FrameLoaderClientEfl::didPerformFirstNavigation() const
472 ewk_frame_did_perform_first_navigation(m_frame);
475 void FrameLoaderClientEfl::registerForIconNotification(bool)
480 void FrameLoaderClientEfl::setMainFrameDocumentReady(bool)
482 // this is only interesting once we provide an external API for the DOM
485 bool FrameLoaderClientEfl::hasWebView() const
493 bool FrameLoaderClientEfl::hasFrameView() const
499 void FrameLoaderClientEfl::dispatchDidFinishLoad()
501 m_loadError = ResourceError(); /* clears previous error */
504 void FrameLoaderClientEfl::frameLoadCompleted()
506 // Note: Can be called multiple times.
509 void FrameLoaderClientEfl::saveViewStateToItem(HistoryItem* item)
511 ewk_frame_view_state_save(m_frame, item);
514 void FrameLoaderClientEfl::restoreViewState()
519 ewk_view_restore_state(m_view, m_frame);
522 void FrameLoaderClientEfl::updateGlobalHistoryRedirectLinks()
526 bool FrameLoaderClientEfl::shouldGoToHistoryItem(HistoryItem* item) const
528 // FIXME: This is a very simple implementation. More sophisticated
529 // implementation would delegate the decision to a PolicyDelegate.
530 // See mac implementation for example.
534 bool FrameLoaderClientEfl::shouldStopLoadingForHistoryItem(HistoryItem* item) const
539 void FrameLoaderClientEfl::didDisplayInsecureContent()
544 void FrameLoaderClientEfl::didRunInsecureContent(SecurityOrigin*, const KURL&)
549 void FrameLoaderClientEfl::makeRepresentation(DocumentLoader*)
551 m_hasRepresentation = true;
554 void FrameLoaderClientEfl::forceLayout()
556 ewk_frame_force_layout(m_frame);
559 void FrameLoaderClientEfl::forceLayoutForNonHTML()
563 void FrameLoaderClientEfl::setCopiesOnScroll()
565 // apparently mac specific (Qt comment)
568 void FrameLoaderClientEfl::detachedFromParent2()
572 void FrameLoaderClientEfl::detachedFromParent3()
576 void FrameLoaderClientEfl::loadedFromCachedPage()
581 void FrameLoaderClientEfl::dispatchDidHandleOnloadEvents()
586 void FrameLoaderClientEfl::dispatchDidReceiveServerRedirectForProvisionalLoad()
591 void FrameLoaderClientEfl::dispatchDidCancelClientRedirect()
596 void FrameLoaderClientEfl::dispatchWillPerformClientRedirect(const KURL&, double, double)
601 void FrameLoaderClientEfl::dispatchDidChangeLocationWithinPage()
603 ewk_frame_uri_changed(m_frame);
605 if (ewk_view_frame_main_get(m_view) != m_frame)
607 ewk_view_uri_changed(m_view);
610 void FrameLoaderClientEfl::dispatchWillClose()
615 void FrameLoaderClientEfl::dispatchDidReceiveIcon()
617 /* report received favicon only for main frame. */
618 if (ewk_view_frame_main_get(m_view) != m_frame)
621 ewk_view_frame_main_icon_received(m_view);
624 void FrameLoaderClientEfl::dispatchDidStartProvisionalLoad()
626 ewk_frame_load_provisional(m_frame);
627 if (ewk_view_frame_main_get(m_view) == m_frame)
628 ewk_view_load_provisional(m_view);
631 void FrameLoaderClientEfl::dispatchDidReceiveTitle(const StringWithDirection& title)
633 // FIXME: use direction of title.
634 CString cs = title.string().utf8();
635 ewk_frame_title_set(m_frame, cs.data());
637 if (ewk_view_frame_main_get(m_view) != m_frame)
639 ewk_view_title_set(m_view, cs.data());
642 void FrameLoaderClientEfl::dispatchDidChangeIcons(WebCore::IconType)
647 void FrameLoaderClientEfl::dispatchDidCommitLoad()
649 ewk_frame_uri_changed(m_frame);
650 if (ewk_view_frame_main_get(m_view) != m_frame)
652 ewk_view_title_set(m_view, 0);
653 ewk_view_uri_changed(m_view);
656 void FrameLoaderClientEfl::dispatchDidFinishDocumentLoad()
658 ewk_frame_load_document_finished(m_frame);
661 void FrameLoaderClientEfl::dispatchDidFirstLayout()
663 ewk_frame_load_firstlayout_finished(m_frame);
666 void FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout()
668 ewk_frame_load_firstlayout_nonempty_finished(m_frame);
671 void FrameLoaderClientEfl::dispatchShow()
673 ewk_view_load_show(m_view);
676 void FrameLoaderClientEfl::cancelPolicyCheck()
681 void FrameLoaderClientEfl::dispatchDidLoadMainResource(DocumentLoader*)
686 void FrameLoaderClientEfl::revertToProvisionalState(DocumentLoader*)
688 m_hasRepresentation = true;
691 void FrameLoaderClientEfl::willChangeTitle(DocumentLoader*)
693 // no need for, dispatchDidReceiveTitle is the right callback
696 void FrameLoaderClientEfl::didChangeTitle(DocumentLoader *l)
698 // no need for, dispatchDidReceiveTitle is the right callback
701 bool FrameLoaderClientEfl::canHandleRequest(const ResourceRequest&) const
707 bool FrameLoaderClientEfl::canShowMIMETypeAsHTML(const String& MIMEType) const
713 bool FrameLoaderClientEfl::canShowMIMEType(const String& MIMEType) const
715 if (MIMETypeRegistry::isSupportedImageMIMEType(MIMEType))
718 if (MIMETypeRegistry::isSupportedNonImageMIMEType(MIMEType))
721 #if 0 // PluginDatabase is disabled until we have Plugin system done.
722 if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(MIMEType))
729 bool FrameLoaderClientEfl::representationExistsForURLScheme(const String&) const
734 String FrameLoaderClientEfl::generatedMIMETypeForURLScheme(const String&) const
740 void FrameLoaderClientEfl::finishedLoading(DocumentLoader* documentLoader)
743 if (m_hasRepresentation)
744 documentLoader->writer()->setEncoding("", false);
747 m_pluginView->didFinishLoading();
749 m_hasSentResponseToPlugin = false;
753 void FrameLoaderClientEfl::provisionalLoadStarted()
758 void FrameLoaderClientEfl::didFinishLoad()
763 void FrameLoaderClientEfl::prepareForDataSourceReplacement()
768 void FrameLoaderClientEfl::setTitle(const StringWithDirection& title, const KURL& url)
770 // no need for, dispatchDidReceiveTitle is the right callback
773 void FrameLoaderClientEfl::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength)
778 void FrameLoaderClientEfl::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
783 void FrameLoaderClientEfl::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& err)
788 bool FrameLoaderClientEfl::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length)
794 void FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const String&)
799 void FrameLoaderClientEfl::dispatchDidFailProvisionalLoad(const ResourceError& err)
801 dispatchDidFailLoad(err);
804 void FrameLoaderClientEfl::dispatchDidFailLoad(const ResourceError& err)
806 if (!shouldFallBack(err))
810 ewk_frame_load_error(m_frame,
811 m_loadError.domain().utf8().data(),
812 m_loadError.errorCode(), m_loadError.isCancellation(),
813 m_loadError.localizedDescription().utf8().data(),
814 m_loadError.failingURL().utf8().data());
817 void FrameLoaderClientEfl::download(ResourceHandle*, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse&)
822 CString url = request.url().string().utf8();
823 Ewk_Download download;
825 download.url = url.data();
826 ewk_view_download_request(m_view, &download);
829 // copied from WebKit/Misc/WebKitErrors[Private].h
831 WebKitErrorCannotShowMIMEType = 100,
832 WebKitErrorCannotShowURL = 101,
833 WebKitErrorFrameLoadInterruptedByPolicyChange = 102,
834 WebKitErrorCannotUseRestrictedPort = 103,
835 WebKitErrorCannotFindPlugIn = 200,
836 WebKitErrorCannotLoadPlugIn = 201,
837 WebKitErrorJavaUnavailable = 202,
840 ResourceError FrameLoaderClientEfl::cancelledError(const ResourceRequest& request)
842 ResourceError error("Error", -999, request.url().string(),
843 "Request cancelled");
844 error.setIsCancellation(true);
848 ResourceError FrameLoaderClientEfl::blockedError(const ResourceRequest& request)
850 return ResourceError("Error", WebKitErrorCannotUseRestrictedPort, request.url().string(),
854 ResourceError FrameLoaderClientEfl::cannotShowURLError(const ResourceRequest& request)
856 return ResourceError("Error", WebKitErrorCannotShowURL, request.url().string(),
860 ResourceError FrameLoaderClientEfl::interruptedForPolicyChangeError(const ResourceRequest& request)
862 return ResourceError("Error", WebKitErrorFrameLoadInterruptedByPolicyChange,
863 request.url().string(), "Frame load interrupted by policy change");
866 ResourceError FrameLoaderClientEfl::cannotShowMIMETypeError(const ResourceResponse& response)
868 return ResourceError("Error", WebKitErrorCannotShowMIMEType, response.url().string(),
869 "Cannot show mimetype");
872 ResourceError FrameLoaderClientEfl::fileDoesNotExistError(const ResourceResponse& response)
874 return ResourceError("Error", -998 /* ### */, response.url().string(),
875 "File does not exist");
878 ResourceError FrameLoaderClientEfl::pluginWillHandleLoadError(const ResourceResponse&)
881 return ResourceError("Error", 0, "", "");
884 bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error)
886 return !(error.isCancellation() || (error.errorCode() == WebKitErrorFrameLoadInterruptedByPolicyChange));
889 bool FrameLoaderClientEfl::canCachePage() const
894 Frame* FrameLoaderClientEfl::dispatchCreatePage(const NavigationAction&)
899 Evas_Object* newView = ewk_view_window_create(m_view, EINA_FALSE, 0);
900 Evas_Object* mainFrame;
904 mainFrame = ewk_view_frame_main_get(newView);
906 return ewk_frame_core_get(mainFrame);
909 void FrameLoaderClientEfl::dispatchUnableToImplementPolicy(const ResourceError&)
914 void FrameLoaderClientEfl::setMainDocumentError(DocumentLoader* loader, const ResourceError& error)
918 m_pluginView->didFail(error);
920 m_hasSentResponseToPlugin = false;
923 void FrameLoaderClientEfl::startDownload(const ResourceRequest& request, const String& /* suggestedName */)
928 CString url = request.url().string().utf8();
929 Ewk_Download download;
931 download.url = url.data();
932 ewk_view_download_request(m_view, &download);
935 void FrameLoaderClientEfl::updateGlobalHistory()
940 void FrameLoaderClientEfl::savePlatformDataToCachedFrame(CachedFrame*)
945 void FrameLoaderClientEfl::transitionToCommittedFromCachedFrame(CachedFrame*)
949 void FrameLoaderClientEfl::transitionToCommittedForNewPage()
954 ewk_frame_view_create_for_view(m_frame, m_view);
956 if (m_frame == ewk_view_frame_main_get(m_view))
957 ewk_view_frame_main_cleared(m_view);
960 void FrameLoaderClientEfl::didSaveToPageCache()
964 void FrameLoaderClientEfl::didRestoreFromPageCache()
968 void FrameLoaderClientEfl::dispatchDidBecomeFrameset(bool)
972 PassRefPtr<FrameNetworkingContext> FrameLoaderClientEfl::createNetworkingContext()
974 return FrameNetworkingContextEfl::create(ewk_frame_core_get(m_frame));