NavigatorContentUtils.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2011, Google Inc. All rights reserved.
  3. * Copyright (C) 2012, Samsung Electronics. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
  15. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
  18. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  20. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  21. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  24. * DAMAGE.
  25. */
  26. #ifndef NavigatorContentUtils_h
  27. #define NavigatorContentUtils_h
  28. #if ENABLE(NAVIGATOR_CONTENT_UTILS)
  29. #include "NavigatorContentUtilsClient.h"
  30. #include "RefCountedSupplement.h"
  31. #include <wtf/PassRefPtr.h>
  32. #include <wtf/text/WTFString.h>
  33. namespace WebCore {
  34. class Page;
  35. class Navigator;
  36. typedef int ExceptionCode;
  37. class NavigatorContentUtils : public RefCountedSupplement<Page, NavigatorContentUtils> {
  38. public:
  39. virtual ~NavigatorContentUtils();
  40. static const char* supplementName();
  41. static NavigatorContentUtils* from(Page*);
  42. static void registerProtocolHandler(Navigator*, const String& scheme, const String& url, const String& title, ExceptionCode&);
  43. #if ENABLE(CUSTOM_SCHEME_HANDLER)
  44. static String isProtocolHandlerRegistered(Navigator*, const String& scheme, const String& url, ExceptionCode&);
  45. static void unregisterProtocolHandler(Navigator*, const String& scheme, const String& url, ExceptionCode&);
  46. #endif
  47. static PassRefPtr<NavigatorContentUtils> create(NavigatorContentUtilsClient*);
  48. private:
  49. explicit NavigatorContentUtils(NavigatorContentUtilsClient* client)
  50. : m_client(client)
  51. { }
  52. NavigatorContentUtilsClient* client() { return m_client; }
  53. NavigatorContentUtilsClient* m_client;
  54. };
  55. } // namespace WebCore
  56. #endif // ENABLE(NAVIGATOR_CONTENT_UTILS)
  57. #endif // NavigatorContentUtils_h