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