| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/web/public/test/fakes/test_native_content_provider.h" | 5 #import "ios/web/public/test/fakes/test_native_content_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 @implementation TestNativeContentProvider { | 11 @implementation TestNativeContentProvider { |
| 12 std::map<GURL, id<CRWNativeContent>> _nativeContent; | 12 std::map<GURL, id<CRWNativeContent>> _nativeContent; |
| 13 } | 13 } |
| 14 | 14 |
| 15 - (void)setController:(id<CRWNativeContent>)controller forURL:(const GURL&)URL { | 15 - (void)setController:(id<CRWNativeContent>)controller forURL:(const GURL&)URL { |
| 16 _nativeContent[URL] = controller; | 16 _nativeContent[URL] = controller; |
| 17 } | 17 } |
| 18 | 18 |
| 19 - (BOOL)hasControllerForURL:(const GURL&)URL { | 19 - (BOOL)hasControllerForURL:(const GURL&)URL { |
| 20 return _nativeContent.find(URL) != _nativeContent.end(); | 20 return _nativeContent.find(URL) != _nativeContent.end(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL { | 23 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL |
| 24 webState:(web::WebState*)webState { |
| 24 auto nativeContent = _nativeContent.find(URL); | 25 auto nativeContent = _nativeContent.find(URL); |
| 25 if (nativeContent == _nativeContent.end()) { | 26 if (nativeContent == _nativeContent.end()) { |
| 26 return nil; | 27 return nil; |
| 27 } | 28 } |
| 28 return nativeContent->second; | 29 return nativeContent->second; |
| 29 } | 30 } |
| 30 | 31 |
| 31 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL | 32 - (id<CRWNativeContent>)controllerForURL:(const GURL&)URL |
| 32 withError:(NSError*)error | 33 withError:(NSError*)error |
| 33 isPost:(BOOL)isPost { | 34 isPost:(BOOL)isPost { |
| 34 NOTREACHED(); | 35 NOTREACHED(); |
| 35 return nil; | 36 return nil; |
| 36 } | 37 } |
| 37 | 38 |
| 38 @end | 39 @end |
| OLD | NEW |