[WK2][EFL] Stop using internal C++ API in ewk_error
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 06:57:53 +0000 (06:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 06:57:53 +0000 (06:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108796

Patch by Christophe Dumez <dchris@gmail.com> on 2013-02-18
Reviewed by Benjamin Poulain.

Stop using internal C++ API in ewk_error and use C API instead of avoid
violating API layering.

* UIProcess/API/efl/ewk_error.cpp:
(EwkError::domain):
(EwkError::isCancellation):
(ewk_error_type_get):
* UIProcess/API/efl/ewk_error_private.h:
(EwkError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143297 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/efl/ewk_error.cpp
Source/WebKit2/UIProcess/API/efl/ewk_error_private.h

index ed9c03a8efa5ac3636db23959ee03496870c7d97..60effb360bb01677e27e8493db709566d47d2b90 100644 (file)
@@ -1,3 +1,20 @@
+2013-02-18  Christophe Dumez  <dchris@gmail.com>
+
+        [WK2][EFL] Stop using internal C++ API in ewk_error
+        https://bugs.webkit.org/show_bug.cgi?id=108796
+
+        Reviewed by Benjamin Poulain.
+
+        Stop using internal C++ API in ewk_error and use C API instead of avoid
+        violating API layering.
+
+        * UIProcess/API/efl/ewk_error.cpp:
+        (EwkError::domain):
+        (EwkError::isCancellation):
+        (ewk_error_type_get):
+        * UIProcess/API/efl/ewk_error_private.h:
+        (EwkError):
+
 2013-02-18  Simon Fraser  <simon.fraser@apple.com>
 
         Clean up the boolean argument to visibleContentRect
index cb9d68e1caf5e90d7d545c637f8e459a5e993364..29031fdf40b77390cdb4a16b0980b36507f9a666 100644 (file)
 #include "ewk_error.h"
 
 #include "ErrorsEfl.h"
+#include "WKError.h"
 #include "WKString.h"
 #include "WKURL.h"
 #include "ewk_error_private.h"
-#include <WKAPICast.h>
-#include <wtf/text/CString.h>
 
 using namespace WebCore;
-using namespace WebKit;
 
 EwkError::EwkError(WKErrorRef errorRef)
     : m_wkError(errorRef)
@@ -52,10 +50,9 @@ const char* EwkError::description() const
     return m_description;
 }
 
-String EwkError::domain() const
+WKRetainPtr<WKStringRef> EwkError::domain() const
 {
-    WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(m_wkError.get()));
-    return toWTFString(wkDomain.get());
+    return adoptWK(WKErrorCopyDomain(m_wkError.get()));
 }
 
 int EwkError::errorCode() const
@@ -65,25 +62,26 @@ int EwkError::errorCode() const
 
 bool EwkError::isCancellation() const
 {
-    return toImpl(m_wkError.get())->platformError().isCancellation();
+    return WKStringIsEqualToUTF8CString(domain().get(), errorDomainNetwork) && errorCode() == NetworkErrorCancelled;
 }
 
 Ewk_Error_Type ewk_error_type_get(const Ewk_Error* error)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(error, EWK_ERROR_TYPE_NONE);
 
-    String errorDomain = error->domain();
+    WKRetainPtr<WKStringRef> wkErrorDomain = error->domain();
 
-    if (errorDomain == errorDomainNetwork)
+    if (WKStringIsEqualToUTF8CString(wkErrorDomain.get(), errorDomainNetwork))
         return EWK_ERROR_TYPE_NETWORK;
-    if (errorDomain == errorDomainPolicy)
+    if (WKStringIsEqualToUTF8CString(wkErrorDomain.get(), errorDomainPolicy))
         return EWK_ERROR_TYPE_POLICY;
-    if (errorDomain == errorDomainPlugin)
+    if (WKStringIsEqualToUTF8CString(wkErrorDomain.get(), errorDomainPlugin))
         return EWK_ERROR_TYPE_PLUGIN;
-    if (errorDomain == errorDomainDownload)
+    if (WKStringIsEqualToUTF8CString(wkErrorDomain.get(), errorDomainDownload))
         return EWK_ERROR_TYPE_DOWNLOAD;
-    if (errorDomain == errorDomainPrint)
+    if (WKStringIsEqualToUTF8CString(wkErrorDomain.get(), errorDomainPrint))
         return EWK_ERROR_TYPE_PRINT;
+
     return EWK_ERROR_TYPE_INTERNAL;
 }
 
index 0a3873bb7b685c2aa6c01c281dd2e803ada848ff..54682f076b965c586dc7a31efb60af013fc68fad 100644 (file)
 #define ewk_error_private_h
 
 #include "WKEinaSharedString.h"
-#include <WKError.h>
 #include <WKRetainPtr.h>
+#include <WebKit2/WKBase.h>
 #include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
 
 class EwkError {
 public:
@@ -44,7 +43,7 @@ public:
 
     const char* url() const;
     const char* description() const;
-    String domain() const;
+    WKRetainPtr<WKStringRef> domain() const;
     int errorCode() const;
     bool isCancellation() const;