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

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

Issue 1048613002: Upstream ios/web/web_state/ui support classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_WK_SCRIPT_MESSAGE_ROUTER_H_
Eugene But (OOO till 7-30) 2015/03/30 05:03:58 Optional: I think I can remove this class at all v
stuartmorgan 2015/03/30 14:17:57 Done.
6 #define IOS_WEB_WEB_STATE_UI_CRW_WK_SCRIPT_MESSAGE_ROUTER_H_
7
8 #import <WebKit/WebKit.h>
9
10 // WKUserContentController wrapper that allows adding multiple message handlers
11 // for the same message name. CRWWKScriptMessageRouter will route the messages
12 // from the underlying user content controller to a designated reciever by
13 // matching the message's name and webView.
14 @interface CRWWKScriptMessageRouter : NSObject
15
16 // Underlying WKUserContentController.
17 @property(nonatomic, readonly) WKUserContentController* userContentController;
18
19 // Designated initializer. |userContentController| must not be nil.
20 - (instancetype)initWithUserContentController:
21 (WKUserContentController*)userContentController;
22
23 // Sets a script message handler. Multiple message handlers can be added for
24 // the same message name and long as |webView| are different. Setting |handler|
25 // for the same |name| and |webView| pair is an error. |handler| will be called
26 // if WKScriptMessage sent by WKUserContentController will match both the |name|
27 // and the |webView|.
28 - (void)setScriptMessageHandler:(void(^)(WKScriptMessage*))handler
29 name:(NSString*)messageName
30 webView:(WKWebView*)webView;
31
32 // Removes a specific message handler.
33 - (void)removeScriptMessageHandlerForName:(NSString*)messageName
34 webView:(WKWebView*)webView;
35
36 // Removes all message handlers for the given |webView|.
37 - (void)removeAllScriptMessageHandlersForWebView:(WKWebView*)webView;
38
39 @end
40
41 #endif // IOS_WEB_WEB_STATE_UI_CRW_WK_SCRIPT_MESSAGE_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698