| 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 "NavigatorContentUtilsClientMock.h" | 5 #include "NavigatorContentUtilsClientMock.h" |
| 6 | 6 |
| 7 #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" | 7 #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" |
| 8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
| 9 #include "wtf/text/StringHash.h" | 9 #include "wtf/text/StringHash.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 void NavigatorContentUtilsClientMock::registerProtocolHandler( | 13 void NavigatorContentUtilsClientMock::registerProtocolHandler( |
| 14 const String& scheme, | 14 const String& scheme, |
| 15 const KURL& url, | 15 const KURL& url, |
| 16 const String& title) { | 16 const String& title) { |
| 17 ProtocolInfo info; | 17 ProtocolInfo info; |
| 18 info.scheme = scheme; | 18 info.scheme = scheme; |
| 19 info.url = url; | 19 info.url = url; |
| 20 info.title = title; | 20 info.title = title; |
| 21 | 21 |
| 22 m_protocolMap.set(scheme, info); | 22 m_protocolMap.set(scheme, info); |
| 23 } | 23 } |
| 24 | 24 |
| 25 NavigatorContentUtilsClient::CustomHandlersState | 25 NavigatorContentUtilsClient::CustomHandlersState |
| 26 NavigatorContentUtilsClientMock::isProtocolHandlerRegistered( | 26 NavigatorContentUtilsClientMock::isProtocolHandlerRegistered( |
| 27 const String& scheme, | 27 const String& scheme, |
| 28 const KURL& url) { | 28 const KURL& url) { |
| 29 // "declined" state is checked by NavigatorContentUtils::isProtocolHandlerRegi
stered() before calling this function. | 29 // "declined" state is checked by |
| 30 // NavigatorContentUtils::isProtocolHandlerRegistered() before calling this |
| 31 // function. |
| 30 if (m_protocolMap.contains(scheme)) | 32 if (m_protocolMap.contains(scheme)) |
| 31 return NavigatorContentUtilsClient::CustomHandlersRegistered; | 33 return NavigatorContentUtilsClient::CustomHandlersRegistered; |
| 32 | 34 |
| 33 return NavigatorContentUtilsClient::CustomHandlersNew; | 35 return NavigatorContentUtilsClient::CustomHandlersNew; |
| 34 } | 36 } |
| 35 | 37 |
| 36 void NavigatorContentUtilsClientMock::unregisterProtocolHandler( | 38 void NavigatorContentUtilsClientMock::unregisterProtocolHandler( |
| 37 const String& scheme, | 39 const String& scheme, |
| 38 const KURL& url) { | 40 const KURL& url) { |
| 39 m_protocolMap.remove(scheme); | 41 m_protocolMap.remove(scheme); |
| 40 } | 42 } |
| 41 | 43 |
| 42 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |