Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: ios/web/public/test/fakes/test_native_content_provider.mm

Issue 2655463014: Pass the correct webState to the nativeContent. (Closed)
Patch Set: s/ithW// Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/preload_controller.mm ('k') | ios/web/public/web_state/ui/crw_native_content_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698