Index: Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp |
diff --git a/Source/platform/weborigin/KURLHash.h b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp |
similarity index 51% |
copy from Source/platform/weborigin/KURLHash.h |
copy to Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp |
index 47d234582914cafdc55157d34b9a294b7dab066e..4cb91d71678ad8d7d94ad975a059ac1935b8d5ac 100644 |
--- a/Source/platform/weborigin/KURLHash.h |
+++ b/Source/modules/navigatorcontentutils/testing/NavigatorContentUtilsClientMock.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
+ * Copyright (C) 2014 Samsung Electronics. All Rights Reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -23,35 +23,41 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef KURLHash_h |
-#define KURLHash_h |
+#include "config.h" |
+#include "NavigatorContentUtilsClientMock.h" |
-#include "platform/weborigin/KURL.h" |
+#include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" |
+#include "wtf/PassOwnPtr.h" |
#include "wtf/text/StringHash.h" |
-#include "wtf/text/WTFString.h" |
namespace WebCore { |
-struct KURLHash { |
- static unsigned hash(const KURL& key) |
- { |
- return key.string().impl()->hash(); |
- } |
- |
- static bool equal(const KURL& a, const KURL& b) |
- { |
- return StringHash::equal(a.string(), b.string()); |
- } |
- |
- static const bool safeToCompareToEmptyOrDeleted = false; |
-}; |
- |
-} // namespace WebCore |
- |
-namespace WTF { |
- |
-template<> struct HashTraits<WebCore::KURL> : SimpleClassHashTraits<WebCore::KURL> { }; |
- |
-} // namespace WTF |
- |
-#endif // KURLHash_h |
+void NavigatorContentUtilsClientMock::registerProtocolHandler(const String& scheme, const WebCore::KURL& baseURL, |
+ const WebCore::KURL& url, const String& title) |
+{ |
+ ProtocolInfo info; |
+ info.scheme = scheme; |
+ info.baseURL = baseURL; |
+ info.url = url; |
+ info.title = title; |
+ |
+ m_protocolMap.set(scheme, info); |
+} |
+ |
+NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientMock::isProtocolHandlerRegistered(const String& scheme, |
+ const WebCore::KURL& baseURL, const WebCore::KURL& url) |
+{ |
+ // "declined" state was checked by NavigatorContentUtils::isProtocolHandlerRegistered() before calling this function. |
+ if (m_protocolMap.contains(scheme)) |
+ return NavigatorContentUtilsClient::CustomHandlersRegistered; |
+ |
+ return NavigatorContentUtilsClient::CustomHandlersNew; |
+} |
+ |
+void NavigatorContentUtilsClientMock::unregisterProtocolHandler(const String& scheme, const WebCore::KURL& baseURL, |
+ const WebCore::KURL& url) |
+{ |
+ m_protocolMap.remove(scheme); |
+} |
+ |
+} // WebCore |