diff options
Diffstat (limited to 'Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h')
-rw-r--r-- | Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h b/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h index 99151c287..bf2647751 100644 --- a/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h +++ b/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h @@ -24,15 +24,13 @@ * DAMAGE. */ -#ifndef NavigatorContentUtils_h -#define NavigatorContentUtils_h +#pragma once #if ENABLE(NAVIGATOR_CONTENT_UTILS) +#include "ExceptionOr.h" #include "NavigatorContentUtilsClient.h" -#include "RefCountedSupplement.h" -#include <wtf/PassRefPtr.h> -#include <wtf/text/WTFString.h> +#include "Supplementable.h" namespace WebCore { @@ -41,34 +39,30 @@ class Navigator; typedef int ExceptionCode; -class NavigatorContentUtils : public RefCountedSupplement<Page, NavigatorContentUtils> { +class NavigatorContentUtils final : public Supplement<Page> { public: + explicit NavigatorContentUtils(std::unique_ptr<NavigatorContentUtilsClient> client) + : m_client(WTFMove(client)) + { } + virtual ~NavigatorContentUtils(); static const char* supplementName(); static NavigatorContentUtils* from(Page*); - static void registerProtocolHandler(Navigator*, const String& scheme, const String& url, const String& title, ExceptionCode&); + static ExceptionOr<void> registerProtocolHandler(Navigator&, const String& scheme, const String& url, const String& title); #if ENABLE(CUSTOM_SCHEME_HANDLER) - static String isProtocolHandlerRegistered(Navigator*, const String& scheme, const String& url, ExceptionCode&); - static void unregisterProtocolHandler(Navigator*, const String& scheme, const String& url, ExceptionCode&); + static ExceptionOr<String> isProtocolHandlerRegistered(Navigator&, const String& scheme, const String& url); + static ExceptionOr<void> unregisterProtocolHandler(Navigator&, const String& scheme, const String& url); #endif - static PassRefPtr<NavigatorContentUtils> create(NavigatorContentUtilsClient*); - private: - explicit NavigatorContentUtils(NavigatorContentUtilsClient* client) - : m_client(client) - { } - - NavigatorContentUtilsClient* client() { return m_client; } + NavigatorContentUtilsClient* client() { return m_client.get(); } - NavigatorContentUtilsClient* m_client; + std::unique_ptr<NavigatorContentUtilsClient> m_client; }; } // namespace WebCore #endif // ENABLE(NAVIGATOR_CONTENT_UTILS) - -#endif // NavigatorContentUtils_h |