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>
11 @
class CRWWebController
;
12 @protocol CRWWebViewProxy
;
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
23 @protocol CRWWebControllerObserver
<NSObject
>
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
;
53 #endif // IOS_WEB_PUBLIC_WEB_STATE_CRW_WEB_CONTROLLER_OBSERVER_H_