Modified: trunk/Source/WebKit2/ChangeLog (141580 => 141581)
--- trunk/Source/WebKit2/ChangeLog 2013-02-01 12:54:33 UTC (rev 141580)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-01 12:56:17 UTC (rev 141581)
@@ -1,3 +1,28 @@
+2013-02-01 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Use C API inside ewk_auth_request
+ https://bugs.webkit.org/show_bug.cgi?id=107806
+
+ Reviewed by Andreas Kling.
+
+ Use C API inside ewk_auth_request instead of accessing C++ internal
+ classes directly, to avoid violating layering.
+
+ * UIProcess/API/efl/ewk_auth_request.cpp:
+ (EwkAuthRequest::EwkAuthRequest):
+ (EwkAuthRequest::suggestedUsername):
+ (EwkAuthRequest::realm):
+ (EwkAuthRequest::host):
+ (EwkAuthRequest::continueWithoutCredential):
+ (EwkAuthRequest::authenticate):
+ (EwkAuthRequest::isRetrying):
+ (ewk_auth_request_authenticate):
+ * UIProcess/API/efl/ewk_auth_request_private.h:
+ (EwkAuthRequest::create):
+ (EwkAuthRequest):
+ * UIProcess/efl/PageLoadClientEfl.cpp:
+ (WebKit::PageLoadClientEfl::didReceiveAuthenticationChallengeInFrame):
+
2013-02-01 Seulgi Kim <[email protected]>
[Gtk][WK2] Fix build after recent WebKit2 changes
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp (141580 => 141581)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp 2013-02-01 12:54:33 UTC (rev 141580)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.cpp 2013-02-01 12:56:17 UTC (rev 141581)
@@ -26,18 +26,17 @@
#include "config.h"
#include "ewk_auth_request.h"
-#include "AuthenticationChallengeProxy.h"
-#include "AuthenticationDecisionListener.h"
-#include "WebCredential.h"
-#include "WebProtectionSpace.h"
-#include "WebString.h"
+#include "WKAuthenticationChallenge.h"
+#include "WKAuthenticationDecisionListener.h"
+#include "WKCredential.h"
+#include "WKProtectionSpace.h"
+#include "WKString.h"
#include "ewk_auth_request_private.h"
#include <wtf/text/CString.h>
using namespace WebKit;
-using namespace WebCore;
-EwkAuthRequest::EwkAuthRequest(AuthenticationChallengeProxy* authenticationChallenge)
+EwkAuthRequest::EwkAuthRequest(WKAuthenticationChallengeRef authenticationChallenge)
: m_authenticationChallenge(authenticationChallenge)
, m_wasHandled(false)
{
@@ -53,14 +52,14 @@
const char* EwkAuthRequest::suggestedUsername() const
{
if (!m_suggestedUsername) {
- WebCredential* credential = m_authenticationChallenge->proposedCredential();
+ WKRetainPtr<WKCredentialRef> credential = WKAuthenticationChallengeGetProposedCredential(m_authenticationChallenge.get());
ASSERT(credential);
- const String& suggestedUsername = credential->user();
- if (suggestedUsername.isEmpty())
+ WKRetainPtr<WKStringRef> suggestedUsername(AdoptWK, WKCredentialCopyUser(credential.get()));
+ if (!suggestedUsername || WKStringIsEmpty(suggestedUsername.get()))
return 0;
- m_suggestedUsername = suggestedUsername.utf8().data();
+ m_suggestedUsername = suggestedUsername.get();
}
return m_suggestedUsername;
@@ -69,14 +68,14 @@
const char* EwkAuthRequest::realm() const
{
if (!m_realm) {
- WebProtectionSpace* protectionSpace = m_authenticationChallenge->protectionSpace();
+ WKRetainPtr<WKProtectionSpaceRef> protectionSpace = WKAuthenticationChallengeGetProtectionSpace(m_authenticationChallenge.get());
ASSERT(protectionSpace);
- const String& realm = protectionSpace->realm();
- if (realm.isEmpty())
+ WKRetainPtr<WKStringRef> realm(AdoptWK, WKProtectionSpaceCopyRealm(protectionSpace.get()));
+ if (!realm || WKStringIsEmpty(realm.get()))
return 0;
- m_realm = realm.utf8().data();
+ m_realm = realm.get();
}
return m_realm;
@@ -85,14 +84,14 @@
const char* EwkAuthRequest::host() const
{
if (!m_host) {
- WebProtectionSpace* protectionSpace = m_authenticationChallenge->protectionSpace();
+ WKRetainPtr<WKProtectionSpaceRef> protectionSpace = WKAuthenticationChallengeGetProtectionSpace(m_authenticationChallenge.get());
ASSERT(protectionSpace);
- const String& host = protectionSpace->host();
- if (host.isEmpty())
+ WKRetainPtr<WKStringRef> host(AdoptWK, WKProtectionSpaceCopyHost(protectionSpace.get()));
+ if (!host || WKStringIsEmpty(host.get()))
return 0;
- m_host = host.utf8().data();
+ m_host = host.get();
}
return m_host;
@@ -104,26 +103,30 @@
return false;
m_wasHandled = true;
- m_authenticationChallenge->useCredential(0);
+ WKAuthenticationDecisionListenerRef decisionListener = WKAuthenticationChallengeGetDecisionListener(m_authenticationChallenge.get());
+ WKAuthenticationDecisionListenerUseCredential(decisionListener, 0);
return true;
}
-bool EwkAuthRequest::authenticate(const String& username, const String& password)
+bool EwkAuthRequest::authenticate(const char* username, const char* password)
{
if (m_wasHandled)
return false;
m_wasHandled = true;
- RefPtr<WebCredential> credential = WebCredential::create(WebString::create(username).get(), WebString::create(password).get(), CredentialPersistenceForSession);
- m_authenticationChallenge->useCredential(credential.get());
+ WKRetainPtr<WKStringRef> wkUsername(AdoptWK, WKStringCreateWithUTF8CString(username));
+ WKRetainPtr<WKStringRef> wkPassword(AdoptWK, WKStringCreateWithUTF8CString(password));
+ WKRetainPtr<WKCredentialRef> credential(AdoptWK, WKCredentialCreate(wkUsername.get(), wkPassword.get(), kWKCredentialPersistenceForSession));
+ WKAuthenticationDecisionListenerRef decisionListener = WKAuthenticationChallengeGetDecisionListener(m_authenticationChallenge.get());
+ WKAuthenticationDecisionListenerUseCredential(decisionListener, credential.get());
return true;
}
bool EwkAuthRequest::isRetrying() const
{
- return m_authenticationChallenge->previousFailureCount() > 0;
+ return WKAuthenticationChallengeGetPreviousFailureCount(m_authenticationChallenge.get()) > 0;
}
const char* ewk_auth_request_suggested_username_get(const Ewk_Auth_Request* request)
@@ -146,7 +149,7 @@
EINA_SAFETY_ON_NULL_RETURN_VAL(username, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(password, false);
- return impl->authenticate(String::fromUTF8(username), String::fromUTF8(password));
+ return impl->authenticate(username, password);
}
Eina_Bool ewk_auth_request_retrying_get(const Ewk_Auth_Request* request)
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h (141580 => 141581)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h 2013-02-01 12:54:33 UTC (rev 141580)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h 2013-02-01 12:56:17 UTC (rev 141581)
@@ -27,19 +27,17 @@
#define ewk_auth_request_private_h
#include "WKEinaSharedString.h"
+#include "WKRetainPtr.h"
#include "ewk_object_private.h"
+#include <WebKit2/WKBase.h>
#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
-namespace WebKit {
-class AuthenticationChallengeProxy;
-}
-
class EwkAuthRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkAuthRequest)
- static PassRefPtr<EwkAuthRequest> create(WebKit::AuthenticationChallengeProxy* authenticationChallenge)
+ static PassRefPtr<EwkAuthRequest> create(WKAuthenticationChallengeRef authenticationChallenge)
{
return adoptRef(new EwkAuthRequest(authenticationChallenge));
}
@@ -51,12 +49,12 @@
bool isRetrying() const;
bool continueWithoutCredential();
- bool authenticate(const String& username, const String& password);
+ bool authenticate(const char* username, const char* password);
private:
- explicit EwkAuthRequest(WebKit::AuthenticationChallengeProxy* authenticationChallenge);
+ explicit EwkAuthRequest(WKAuthenticationChallengeRef authenticationChallenge);
- RefPtr<WebKit::AuthenticationChallengeProxy> m_authenticationChallenge;
+ WKRetainPtr<WKAuthenticationChallengeRef> m_authenticationChallenge;
bool m_wasHandled;
mutable WKEinaSharedString m_suggestedUsername;
mutable WKEinaSharedString m_realm;
Modified: trunk/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp (141580 => 141581)
--- trunk/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp 2013-02-01 12:54:33 UTC (rev 141580)
+++ trunk/Source/WebKit2/UIProcess/efl/PageLoadClientEfl.cpp 2013-02-01 12:56:17 UTC (rev 141581)
@@ -147,7 +147,7 @@
{
EwkView* view = toPageLoadClientEfl(clientInfo)->view();
- RefPtr<EwkAuthRequest> authenticationRequest = EwkAuthRequest::create(toImpl(authenticationChallenge));
+ RefPtr<EwkAuthRequest> authenticationRequest = EwkAuthRequest::create(authenticationChallenge);
view->smartCallback<AuthenticationRequest>().call(authenticationRequest.get());
}