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

Side by Side Diff: ios/web/web_state/ui/crw_wk_script_message_router.mm

Issue 1516303002: Adds support for POST request with bodies on WKWebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years 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 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 #import "ios/web/web_state/ui/crw_wk_script_message_router.h" 5 #import "ios/web/web_state/ui/crw_wk_script_message_router.h"
6 6
7 #import "base/logging.h" 7 #import "base/logging.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 9
10 @interface CRWWKScriptMessageRouter ()<WKScriptMessageHandler> 10 @interface CRWWKScriptMessageRouter ()<WKScriptMessageHandler>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ((void (^)(WKScriptMessage*))handler)(message); 93 ((void (^)(WKScriptMessage*))handler)(message);
94 } 94 }
95 } 95 }
96 96
97 #pragma mark - 97 #pragma mark -
98 #pragma mark Implementation 98 #pragma mark Implementation
99 99
100 - (void)tryRemoveScriptMessageHandlerForName:(NSString*)messageName 100 - (void)tryRemoveScriptMessageHandlerForName:(NSString*)messageName
101 webView:(WKWebView*)webView { 101 webView:(WKWebView*)webView {
102 NSMapTable* webViewToHandlerMap = [_handlers objectForKey:messageName]; 102 NSMapTable* webViewToHandlerMap = [_handlers objectForKey:messageName];
103 if (![webViewToHandlerMap objectForKey:webView]) 103 id handler = [webViewToHandlerMap objectForKey:webView];
104 if (!handler)
104 return; 105 return;
106 // Extend the lifetime of |handler| so removeScriptMessageHandlerForName: can
107 // be called from inside of |handler|.
108 [[handler retain] autorelease];
105 if (webViewToHandlerMap.count == 1) { 109 if (webViewToHandlerMap.count == 1) {
106 [_handlers removeObjectForKey:messageName]; 110 [_handlers removeObjectForKey:messageName];
107 [_userContentController removeScriptMessageHandlerForName:messageName]; 111 [_userContentController removeScriptMessageHandlerForName:messageName];
108 } else { 112 } else {
109 [webViewToHandlerMap removeObjectForKey:webView]; 113 [webViewToHandlerMap removeObjectForKey:webView];
110 } 114 }
111 } 115 }
112 116
113 @end 117 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/js/resources/post_request.js ('k') | ios/web/web_state/ui/crw_wk_web_view_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698