Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ios / web / public / web_state / ui / crw_native_content.h
blob0273c7b2c47016d78768d61de7f5f034b8fe4094
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>
10 #include "url/gurl.h"
12 @protocol CRWNativeContentDelegate;
14 // Abstract methods needed for manipulating native content in the web content
15 // area.
16 @protocol CRWNativeContent<NSObject>
18 // The page title, meant for display to the user. Will return nil if not
19 // available.
20 - (NSString*)title;
22 // The URL represented by the content being displayed.
23 - (const GURL&)url;
25 // The view to insert into the content area displayed to the user.
26 - (UIView*)view;
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.
36 - (BOOL)isViewAlive;
38 // Reload any displayed data to ensure the view is up to date.
39 - (void)reload;
41 @optional
43 // Optional method that allows to set CRWNativeContent delegate.
44 - (void)setDelegate:(id<CRWNativeContentDelegate>)delegate;
46 // Notifies the CRWNativeContent that it has been shown.
47 - (void)wasShown;
49 // Notifies the CRWNativeContent that it has been hidden.
50 - (void)wasHidden;
52 // Returns |YES| if CRWNativeContent wants the keyboard shield when the keyboard
53 // is up.
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.
70 - (void)close;
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;
81 @end
83 // CRWNativeContent delegate protocol.
84 @protocol CRWNativeContentDelegate<NSObject>
86 @optional
87 // Called when the content supplies a new title.
88 - (void)nativeContent:(id)content titleDidChange:(NSString*)title;
90 @end
92 #endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_NATIVE_CONTENT_H_