OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "NavigatorContentUtilsClientMock.h" |
| 7 |
| 8 #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" |
| 9 #include "wtf/PassOwnPtr.h" |
| 10 #include "wtf/text/StringHash.h" |
| 11 |
| 12 namespace WebCore { |
| 13 |
| 14 void NavigatorContentUtilsClientMock::registerProtocolHandler(const String& sche
me, const WebCore::KURL& baseURL, |
| 15 const WebCore::KURL& url, const String& title) |
| 16 { |
| 17 ProtocolInfo info; |
| 18 info.scheme = scheme; |
| 19 info.baseURL = baseURL; |
| 20 info.url = url; |
| 21 info.title = title; |
| 22 |
| 23 m_protocolMap.set(scheme, info); |
| 24 } |
| 25 |
| 26 NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientMock
::isProtocolHandlerRegistered(const String& scheme, |
| 27 const WebCore::KURL& baseURL, const WebCore::KURL& url) |
| 28 { |
| 29 // "declined" state is checked by NavigatorContentUtils::isProtocolHandlerRe
gistered() before calling this function. |
| 30 if (m_protocolMap.contains(scheme)) |
| 31 return NavigatorContentUtilsClient::CustomHandlersRegistered; |
| 32 |
| 33 return NavigatorContentUtilsClient::CustomHandlersNew; |
| 34 } |
| 35 |
| 36 void NavigatorContentUtilsClientMock::unregisterProtocolHandler(const String& sc
heme, const WebCore::KURL& baseURL, |
| 37 const WebCore::KURL& url) |
| 38 { |
| 39 m_protocolMap.remove(scheme); |
| 40 } |
| 41 |
| 42 } // WebCore |
OLD | NEW |