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 blink::KURL& baseURL, | 14 void NavigatorContentUtilsClientMock::registerProtocolHandler(const String& sche
me, const KURL& baseURL, |
15 const blink::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; | 19 info.baseURL = baseURL; |
20 info.url = url; | 20 info.url = url; |
21 info.title = title; | 21 info.title = title; |
22 | 22 |
23 m_protocolMap.set(scheme, info); | 23 m_protocolMap.set(scheme, info); |
24 } | 24 } |
25 | 25 |
26 NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientMock
::isProtocolHandlerRegistered(const String& scheme, | 26 NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientMock
::isProtocolHandlerRegistered(const String& scheme, |
27 const blink::KURL& baseURL, const blink::KURL& url) | 27 const KURL& baseURL, const KURL& url) |
28 { | 28 { |
29 // "declined" state is checked by NavigatorContentUtils::isProtocolHandlerRe
gistered() before calling this function. | 29 // "declined" state is checked by NavigatorContentUtils::isProtocolHandlerRe
gistered() before calling this function. |
30 if (m_protocolMap.contains(scheme)) | 30 if (m_protocolMap.contains(scheme)) |
31 return NavigatorContentUtilsClient::CustomHandlersRegistered; | 31 return NavigatorContentUtilsClient::CustomHandlersRegistered; |
32 | 32 |
33 return NavigatorContentUtilsClient::CustomHandlersNew; | 33 return NavigatorContentUtilsClient::CustomHandlersNew; |
34 } | 34 } |
35 | 35 |
36 void NavigatorContentUtilsClientMock::unregisterProtocolHandler(const String& sc
heme, const blink::KURL& baseURL, | 36 void NavigatorContentUtilsClientMock::unregisterProtocolHandler(const String& sc
heme, const KURL& baseURL, |
37 const blink::KURL& url) | 37 const KURL& url) |
38 { | 38 { |
39 m_protocolMap.remove(scheme); | 39 m_protocolMap.remove(scheme); |
40 } | 40 } |
41 | 41 |
42 } // namespace blink | 42 } // namespace blink |
OLD | NEW |