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_UI_CRW_NATIVE_CONTENT_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_NATIVE_CONTENT_H_
8 #import <UIKit/UIKit.h>
12 @protocol CRWNativeContentDelegate
;
14 // Abstract methods needed for manipulating native content in the web content
16 @protocol CRWNativeContent
<NSObject
>
18 // The page title, meant for display to the user. Will return nil if not
22 // The URL represented by the content being displayed.
25 // The view to insert into the content area displayed to the user.
28 // Called when memory is low. Release anything (such as views) that can be
29 // easily re-created to free up RAM.
30 - (void)handleLowMemory
;
32 // Returns YES if there is currently a live view in the tab (e.g., the view
33 // hasn't been discarded due to low memory).
34 // NOTE: This should be used for metrics-gathering only; for any other purpose
35 // callers should not know or care whether the view is live.
38 // Reload any displayed data to ensure the view is up to date.
43 // Optional method that allows to set CRWNativeContent delegate.
44 - (void)setDelegate
:(id
<CRWNativeContentDelegate
>)delegate
;
46 // Notifies the CRWNativeContent that it has been shown.
49 // Notifies the CRWNativeContent that it has been hidden.
52 // Returns |YES| if CRWNativeContent wants the keyboard shield when the keyboard
54 - (BOOL
)wantsKeyboardShield
;
56 // Returns |YES| if CRWNativeContent wants the hint text displayed.
57 // TODO(shreyasv): Remove this. This is chrome level concept and should not
58 // exist in the web/ layer. crbug.com/374984.
59 - (BOOL
)wantsLocationBarHintText
;
61 // Dismisses on-screen keyboard if necessary.
62 - (void)dismissKeyboard
;
64 // Dismisses any outstanding modal interaction elements (e.g. modal view
65 // controllers, context menus, etc).
66 - (void)dismissModals
;
68 // A native content controller should do any clean up at this time when
69 // WebController closes.
72 // Enables or disables usage of web views inside the native controller.
73 - (void)setWebUsageEnabled
:(BOOL
)webUsageEnabled
;
75 // Enables or disables the scrolling in the native view (when available).
76 - (void)setScrollEnabled
:(BOOL
)enabled
;
78 // Called when a snapshot of the content will be taken.
79 - (void)willUpdateSnapshot
;
83 // CRWNativeContent delegate protocol.
84 @protocol CRWNativeContentDelegate
<NSObject
>
87 // Called when the content supplies a new title.
88 - (void)nativeContent
:(id
)content titleDidChange
:(NSString
*)title
;
92 #endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_NATIVE_CONTENT_H_