Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ios / web / public / web_state / crw_web_controller_observer.h
blob7d6a2541d98a798067f1323aafbd4e8a09ee8358
1 // Copyright 2012 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.
5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_
8 #import <Foundation/Foundation.h>
9 #include <string>
11 @class CRWWebController;
12 @protocol CRWWebViewProxy;
13 class GURL;
14 @class UIWebView;
16 namespace base {
17 class DictionaryValue;
20 // NOTE: When adding new methods to CRWWebControllerObserver, consider adding
21 // them to WebStateObserver instead if they need to be surfaced to the public
22 // API.
23 @protocol CRWWebControllerObserver<NSObject>
25 @optional
27 // Supplies a text prefix to the CRWWebController to indicate which commands the
28 // observer should receive using the handleCommand message.
29 // Called only as the observer is added to its parent CRWWebController.
30 @property(nonatomic, readonly) NSString* commandPrefix;
32 // Called when the current page is loaded.
33 // DEPRECATED: Use WebStateObserver instead.
34 - (void)pageLoaded:(CRWWebController*)webController;
36 // Called when the web controller is about to close.
37 - (void)webControllerWillClose:(CRWWebController*)webController;
39 // Handle the command from page scripts. Return NO if the command was known to
40 // be invalid. This will cause the page to be reset as a security precaution.
41 // DEPRECATED: Use WebState::ScriptCommandCallback instead.
42 - (BOOL)handleCommand:(const base::DictionaryValue&)command
43 webController:(CRWWebController*)webController
44 userIsInteracting:(BOOL)userIsInteracting
45 originURL:(const GURL&)originURL;
47 // Gives CRWWebControllerObservers access to the CRWWebViewProxy.
48 - (void)setWebViewProxy:(id<CRWWebViewProxy>)webView
49 controller:(CRWWebController*)webController;
51 @end
53 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_