[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 1 | // Copyright 2013 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 CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 7 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 8 | #include <vector> |
| 9 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 10 | #include "base/basictypes.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 11 | #include "base/files/file_path.h" |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 12 | #include "base/gtest_prod_util.h" |
| 13 | #include "base/id_map.h" |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 15 | #include "base/observer_list.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 16 | #include "base/process/process_handle.h" |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 17 | #include "content/public/common/javascript_message_type.h" |
[email protected] | 65920f33 | 2014-03-04 21:14:18 | [diff] [blame] | 18 | #include "content/public/common/referrer.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 19 | #include "content/public/renderer/render_frame.h" |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 20 | #include "content/renderer/media/webmediaplayer_delegate.h" |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 21 | #include "content/renderer/render_frame_proxy.h" |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 22 | #include "content/renderer/renderer_webcookiejar_impl.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 23 | #include "ipc/ipc_message.h" |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 24 | #include "third_party/WebKit/public/web/WebDataSource.h" |
| 25 | #include "third_party/WebKit/public/web/WebFrameClient.h" |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 26 | #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 27 | #include "ui/gfx/range/range.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 28 | |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 29 | #if defined(OS_ANDROID) |
| 30 | #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 31 | #endif |
| 32 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 33 | class TransportDIB; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 34 | struct FrameMsg_BuffersSwapped_Params; |
| 35 | struct FrameMsg_CompositorFrameSwapped_Params; |
[email protected] | c6bc2033 | 2014-02-28 18:30:39 | [diff] [blame] | 36 | struct FrameMsg_Navigate_Params; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 37 | |
| 38 | namespace blink { |
[email protected] | 5ee7f18 | 2014-04-25 19:45:26 | [diff] [blame] | 39 | class WebGeolocationClient; |
[email protected] | 5cdd8fd8 | 2014-02-05 20:12:12 | [diff] [blame] | 40 | class WebInputEvent; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 41 | class WebMouseEvent; |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 42 | class WebContentDecryptionModule; |
[email protected] | 8538385f | 2014-04-25 19:45:04 | [diff] [blame] | 43 | class WebMIDIClient; |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 44 | class WebMediaPlayer; |
[email protected] | 1c04825 | 2014-04-11 23:27:34 | [diff] [blame] | 45 | class WebNotificationPresenter; |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 46 | class WebSecurityOrigin; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 47 | struct WebCompositionUnderline; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 48 | struct WebContextMenuData; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 49 | struct WebCursorInfo; |
| 50 | } |
| 51 | |
| 52 | namespace gfx { |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 53 | class Point; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 54 | class Range; |
| 55 | class Rect; |
| 56 | } |
| 57 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 58 | namespace content { |
| 59 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 60 | class ChildFrameCompositingHelper; |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 61 | class MediaStreamRendererFactory; |
[email protected] | 2626d14 | 2014-04-22 17:24:02 | [diff] [blame] | 62 | class NotificationProvider; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 63 | class PepperPluginInstanceImpl; |
| 64 | class RendererPpapiHost; |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 65 | class RenderFrameObserver; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 66 | class RenderViewImpl; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 67 | class RenderWidget; |
| 68 | class RenderWidgetFullscreenPepper; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 69 | struct CustomContextMenuContext; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 70 | |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 71 | #if defined(OS_ANDROID) |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 72 | class RendererCdmManager; |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 73 | class RendererMediaPlayerManager; |
| 74 | #endif |
| 75 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 76 | class CONTENT_EXPORT RenderFrameImpl |
| 77 | : public RenderFrame, |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 78 | NON_EXPORTED_BASE(public blink::WebFrameClient), |
| 79 | NON_EXPORTED_BASE(public WebMediaPlayerDelegate) { |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 80 | public: |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 81 | // Creates a new RenderFrame. |render_view| is the RenderView object that this |
| 82 | // frame belongs to. |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 83 | // Callers *must* call |SetWebFrame| immediately after creation. |
| 84 | // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 85 | static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
| 86 | |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 87 | // Returns the RenderFrameImpl for the given routing ID. |
| 88 | static RenderFrameImpl* FromRoutingID(int routing_id); |
| 89 | |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 90 | // Just like RenderFrame::FromWebFrame but returns the implementation. |
| 91 | static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 92 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 93 | // Used by content_layouttest_support to hook into the creation of |
| 94 | // RenderFrameImpls. |
| 95 | static void InstallCreateHook( |
| 96 | RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
| 97 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 98 | virtual ~RenderFrameImpl(); |
| 99 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 100 | bool is_swapped_out() const { |
| 101 | return is_swapped_out_; |
| 102 | } |
| 103 | |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 104 | // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 105 | // RenderFrames. See https://crbug.com/357747. |
| 106 | void set_render_frame_proxy(RenderFrameProxy* proxy) { |
| 107 | render_frame_proxy_ = proxy; |
| 108 | } |
| 109 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 110 | // Out-of-process child frames receive a signal from RenderWidgetCompositor |
| 111 | // when a compositor frame has committed. |
| 112 | void DidCommitCompositorFrame(); |
| 113 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 114 | // TODO(jam): this is a temporary getter until all the code is transitioned |
| 115 | // to using RenderFrame instead of RenderView. |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 116 | RenderViewImpl* render_view() { return render_view_.get(); } |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 117 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 118 | RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
| 119 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 120 | // Returns the RenderWidget associated with this frame. |
| 121 | RenderWidget* GetRenderWidget(); |
| 122 | |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 123 | // This is called right after creation with the WebLocalFrame for this |
[email protected] | 0287e76 | 2014-04-11 13:07:58 | [diff] [blame] | 124 | // RenderFrame. It must be called before Initialize. |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 125 | void SetWebFrame(blink::WebLocalFrame* web_frame); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 126 | |
[email protected] | 0287e76 | 2014-04-11 13:07:58 | [diff] [blame] | 127 | // This method must be called after the frame has been added to the frame |
| 128 | // tree. It creates all objects that depend on the frame being at its proper |
| 129 | // spot. |
| 130 | void Initialize(); |
| 131 | |
[email protected] | 5815cf5 | 2014-01-29 17:45:05 | [diff] [blame] | 132 | // Notification from RenderView. |
| 133 | virtual void OnStop(); |
| 134 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 135 | // Notifications from RenderWidget. |
| 136 | void WasHidden(); |
| 137 | void WasShown(); |
| 138 | |
[email protected] | 723971b | 2014-02-12 11:08:25 | [diff] [blame] | 139 | // Start/Stop loading notifications. |
| 140 | // TODO(nasko): Those are page-level methods at this time and come from |
| 141 | // WebViewClient. We should move them to be WebFrameClient calls and put |
| 142 | // logic in the browser side to balance starts/stops. |
[email protected] | e3b10d1 | 2014-03-28 16:06:09 | [diff] [blame] | 143 | // |to_different_document| will be true unless the load is a fragment |
| 144 | // navigation, or triggered by history.pushState/replaceState. |
[email protected] | 6dd5c32 | 2014-03-12 07:58:46 | [diff] [blame] | 145 | virtual void didStartLoading(bool to_different_document); |
| 146 | virtual void didStopLoading(); |
| 147 | virtual void didChangeLoadProgress(double load_progress); |
[email protected] | 723971b | 2014-02-12 11:08:25 | [diff] [blame] | 148 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 149 | #if defined(ENABLE_PLUGINS) |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 150 | // Notification that a PPAPI plugin has been created. |
| 151 | void PepperPluginCreated(RendererPpapiHost* host); |
| 152 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 153 | // Notifies that |instance| has changed the cursor. |
| 154 | // This will update the cursor appearance if it is currently over the plugin |
| 155 | // instance. |
| 156 | void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
| 157 | const blink::WebCursorInfo& cursor); |
| 158 | |
| 159 | // Notifies that |instance| has received a mouse event. |
| 160 | void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance); |
| 161 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 162 | // Informs the render view that a PPAPI plugin has changed text input status. |
| 163 | void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance); |
| 164 | void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance); |
| 165 | |
| 166 | // Cancels current composition. |
| 167 | void PepperCancelComposition(PepperPluginInstanceImpl* instance); |
| 168 | |
| 169 | // Informs the render view that a PPAPI plugin has changed selection. |
| 170 | void PepperSelectionChanged(PepperPluginInstanceImpl* instance); |
| 171 | |
| 172 | // Creates a fullscreen container for a pepper plugin instance. |
| 173 | RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
| 174 | PepperPluginInstanceImpl* plugin); |
| 175 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 176 | bool IsPepperAcceptingCompositionEvents() const; |
| 177 | |
| 178 | // Notification that the given plugin has crashed. |
| 179 | void PluginCrashed(const base::FilePath& plugin_path, |
| 180 | base::ProcessId plugin_pid); |
| 181 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 182 | // Simulates IME events for testing purpose. |
| 183 | void SimulateImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 184 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 185 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 186 | int selection_start, |
| 187 | int selection_end); |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 188 | void SimulateImeConfirmComposition(const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 189 | const gfx::Range& replacement_range); |
| 190 | |
| 191 | // TODO(jam): remove these once the IPC handler moves from RenderView to |
| 192 | // RenderFrame. |
| 193 | void OnImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 194 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 195 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 196 | int selection_start, |
| 197 | int selection_end); |
| 198 | void OnImeConfirmComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 199 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 200 | const gfx::Range& replacement_range, |
| 201 | bool keep_selection); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 202 | #endif // ENABLE_PLUGINS |
| 203 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 204 | // IPC::Sender |
| 205 | virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 206 | |
| 207 | // IPC::Listener |
| 208 | virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 209 | |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 210 | // RenderFrame implementation: |
[email protected] | b849847b | 2013-12-10 21:57:58 | [diff] [blame] | 211 | virtual RenderView* GetRenderView() OVERRIDE; |
[email protected] | 60eca4eb | 2013-12-06 00:02:16 | [diff] [blame] | 212 | virtual int GetRoutingID() OVERRIDE; |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 213 | virtual blink::WebFrame* GetWebFrame() OVERRIDE; |
[email protected] | d019e1a38 | 2013-12-11 17:52:06 | [diff] [blame] | 214 | virtual WebPreferences& GetWebkitPreferences() OVERRIDE; |
| 215 | virtual int ShowContextMenu(ContextMenuClient* client, |
| 216 | const ContextMenuParams& params) OVERRIDE; |
| 217 | virtual void CancelContextMenu(int request_id) OVERRIDE; |
[email protected] | 1a6d011 | 2014-03-10 19:08:41 | [diff] [blame] | 218 | virtual blink::WebNode GetContextMenuNode() const OVERRIDE; |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 219 | virtual blink::WebPlugin* CreatePlugin( |
| 220 | blink::WebFrame* frame, |
| 221 | const WebPluginInfo& info, |
| 222 | const blink::WebPluginParams& params) OVERRIDE; |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 223 | virtual void LoadURLExternally(blink::WebLocalFrame* frame, |
| 224 | const blink::WebURLRequest& request, |
| 225 | blink::WebNavigationPolicy policy) OVERRIDE; |
[email protected] | db3be76f | 2014-03-25 02:27:47 | [diff] [blame] | 226 | virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE; |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 227 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 228 | // blink::WebFrameClient implementation: |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 229 | virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, |
| 230 | const blink::WebPluginParams& params); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 231 | virtual blink::WebMediaPlayer* createMediaPlayer( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 232 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 233 | const blink::WebURL& url, |
| 234 | blink::WebMediaPlayerClient* client); |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 235 | virtual blink::WebContentDecryptionModule* createContentDecryptionModule( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 236 | blink::WebLocalFrame* frame, |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 237 | const blink::WebSecurityOrigin& security_origin, |
| 238 | const blink::WebString& key_system); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 239 | virtual blink::WebApplicationCacheHost* createApplicationCacheHost( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 240 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 241 | blink::WebApplicationCacheHostClient* client); |
| 242 | virtual blink::WebWorkerPermissionClientProxy* |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 243 | createWorkerPermissionClientProxy(blink::WebLocalFrame* frame); |
| 244 | virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 245 | virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 246 | blink::WebLocalFrame* frame); |
| 247 | virtual void didAccessInitialDocument(blink::WebLocalFrame* frame); |
| 248 | virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, |
| 249 | const blink::WebString& name); |
| 250 | virtual void didDisownOpener(blink::WebLocalFrame* frame); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 251 | virtual void frameDetached(blink::WebFrame* frame); |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 252 | virtual void frameFocused(); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 253 | virtual void willClose(blink::WebFrame* frame); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 254 | virtual void didChangeName(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 255 | const blink::WebString& name); |
[email protected] | f5b6dd112 | 2013-10-04 02:42:50 | [diff] [blame] | 256 | virtual void didMatchCSS( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 257 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 258 | const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 259 | const blink::WebVector<blink::WebString>& stopped_matching_selectors); |
[email protected] | c31a8480 | 2014-04-03 15:55:49 | [diff] [blame] | 260 | virtual bool shouldReportDetailedMessageForSource( |
| 261 | const blink::WebString& source); |
| 262 | virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, |
| 263 | const blink::WebString& source_name, |
| 264 | unsigned source_line, |
| 265 | const blink::WebString& stack_trace); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 266 | virtual void loadURLExternally(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 267 | const blink::WebURLRequest& request, |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 268 | blink::WebNavigationPolicy policy, |
| 269 | const blink::WebString& suggested_name); |
[email protected] | 1a4e975 | 2013-12-31 20:10:58 | [diff] [blame] | 270 | // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 271 | virtual blink::WebNavigationPolicy decidePolicyForNavigation( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 272 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 273 | blink::WebDataSource::ExtraData* extra_data, |
| 274 | const blink::WebURLRequest& request, |
| 275 | blink::WebNavigationType type, |
| 276 | blink::WebNavigationPolicy default_policy, |
[email protected] | f6ae17fc | 2013-08-19 22:56:17 | [diff] [blame] | 277 | bool is_redirect); |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 278 | virtual blink::WebHistoryItem historyItemForNewChildFrame( |
| 279 | blink::WebFrame* frame); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 280 | virtual void willSendSubmitEvent(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 281 | const blink::WebFormElement& form); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 282 | virtual void willSubmitForm(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 283 | const blink::WebFormElement& form); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 284 | virtual void didCreateDataSource(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 285 | blink::WebDataSource* datasource); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 286 | virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 287 | virtual void didReceiveServerRedirectForProvisionalLoad( |
[email protected] | 45d877f | 2014-04-05 07:36:22 | [diff] [blame] | 288 | blink::WebLocalFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 289 | virtual void didFailProvisionalLoad( |
[email protected] | 45d877f | 2014-04-05 07:36:22 | [diff] [blame] | 290 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 291 | const blink::WebURLError& error); |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 292 | virtual void didCommitProvisionalLoad( |
[email protected] | 45d877f | 2014-04-05 07:36:22 | [diff] [blame] | 293 | blink::WebLocalFrame* frame, |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 294 | const blink::WebHistoryItem& item, |
| 295 | blink::WebHistoryCommitType commit_type); |
[email protected] | 06181e5 | 2014-05-10 11:59:09 | [diff] [blame] | 296 | virtual void didClearWindowObject(blink::WebLocalFrame* frame); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 297 | virtual void didCreateDocumentElement(blink::WebLocalFrame* frame); |
| 298 | virtual void didReceiveTitle(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 299 | const blink::WebString& title, |
| 300 | blink::WebTextDirection direction); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 301 | virtual void didChangeIcon(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 302 | blink::WebIconURL::Type icon_type); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 303 | virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame); |
| 304 | virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame); |
| 305 | virtual void didFailLoad(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 306 | const blink::WebURLError& error); |
[email protected] | 45d877f | 2014-04-05 07:36:22 | [diff] [blame] | 307 | virtual void didFinishLoad(blink::WebLocalFrame* frame); |
| 308 | virtual void didNavigateWithinPage(blink::WebLocalFrame* frame, |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 309 | const blink::WebHistoryItem& item, |
| 310 | blink::WebHistoryCommitType commit_type); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 311 | virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame); |
[email protected] | 1c04825 | 2014-04-11 23:27:34 | [diff] [blame] | 312 | virtual blink::WebNotificationPresenter* notificationPresenter(); |
[email protected] | c3f2c70 | 2014-03-19 23:39:48 | [diff] [blame] | 313 | virtual void didChangeSelection(bool is_empty_selection); |
[email protected] | f3c59d6 | 2014-04-09 16:33:55 | [diff] [blame] | 314 | virtual blink::WebColorChooser* createColorChooser( |
[email protected] | eb8c216a | 2014-04-09 19:19:19 | [diff] [blame] | 315 | blink::WebColorChooserClient* client, |
[email protected] | f3c59d6 | 2014-04-09 16:33:55 | [diff] [blame] | 316 | const blink::WebColor& initial_color, |
| 317 | const blink::WebVector<blink::WebColorSuggestion>& suggestions); |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 318 | virtual void runModalAlertDialog(const blink::WebString& message); |
| 319 | virtual bool runModalConfirmDialog(const blink::WebString& message); |
| 320 | virtual bool runModalPromptDialog(const blink::WebString& message, |
| 321 | const blink::WebString& default_value, |
| 322 | blink::WebString* actual_value); |
| 323 | virtual bool runModalBeforeUnloadDialog(bool is_reload, |
| 324 | const blink::WebString& message); |
[email protected] | 12cc511 | 2014-03-03 17:01:10 | [diff] [blame] | 325 | virtual void showContextMenu(const blink::WebContextMenuData& data); |
[email protected] | 9107034 | 2014-03-07 00:29:02 | [diff] [blame] | 326 | virtual void clearContextMenu(); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 327 | virtual void willRequestAfterPreconnect(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 328 | blink::WebURLRequest& request); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 329 | virtual void willSendRequest(blink::WebLocalFrame* frame, |
| 330 | unsigned identifier, |
| 331 | blink::WebURLRequest& request, |
| 332 | const blink::WebURLResponse& redirect_response); |
| 333 | virtual void didReceiveResponse(blink::WebLocalFrame* frame, |
| 334 | unsigned identifier, |
| 335 | const blink::WebURLResponse& response); |
| 336 | virtual void didFinishResourceLoad(blink::WebLocalFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 337 | unsigned identifier); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 338 | virtual void didLoadResourceFromMemoryCache( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 339 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 340 | const blink::WebURLRequest& request, |
| 341 | const blink::WebURLResponse& response); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 342 | virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame); |
| 343 | virtual void didRunInsecureContent(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 344 | const blink::WebSecurityOrigin& origin, |
| 345 | const blink::WebURL& target); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 346 | virtual void didAbortLoading(blink::WebLocalFrame* frame); |
| 347 | virtual void didCreateScriptContext(blink::WebLocalFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 348 | v8::Handle<v8::Context> context, |
| 349 | int extension_group, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 350 | int world_id); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 351 | virtual void willReleaseScriptContext(blink::WebLocalFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 352 | v8::Handle<v8::Context> context, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 353 | int world_id); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 354 | virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame); |
| 355 | virtual void didChangeContentsSize(blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 356 | const blink::WebSize& size); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 357 | virtual void didChangeScrollOffset(blink::WebLocalFrame* frame); |
| 358 | virtual void willInsertBody(blink::WebLocalFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 359 | virtual void reportFindInPageMatchCount(int request_id, |
| 360 | int count, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 361 | bool final_update); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 362 | virtual void reportFindInPageSelection(int request_id, |
| 363 | int active_match_ordinal, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 364 | const blink::WebRect& sel); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 365 | virtual void requestStorageQuota(blink::WebLocalFrame* frame, |
| 366 | blink::WebStorageQuotaType type, |
| 367 | unsigned long long requested_size, |
| 368 | blink::WebStorageQuotaCallbacks callbacks); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 369 | virtual void willOpenSocketStream( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 370 | blink::WebSocketStreamHandle* handle); |
[email protected] | a14903e0 | 2014-06-02 07:35:12 | [diff] [blame^] | 371 | virtual void willOpenWebSocket(blink::WebSocketHandle* handle); |
[email protected] | 5ee7f18 | 2014-04-25 19:45:26 | [diff] [blame] | 372 | virtual blink::WebGeolocationClient* geolocationClient(); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 373 | virtual void willStartUsingPeerConnectionHandler( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 374 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 375 | blink::WebRTCPeerConnectionHandler* handler); |
[email protected] | bfe45e2 | 2014-04-25 16:47:53 | [diff] [blame] | 376 | virtual blink::WebUserMediaClient* userMediaClient(); |
[email protected] | 8538385f | 2014-04-25 19:45:04 | [diff] [blame] | 377 | virtual blink::WebMIDIClient* webMIDIClient(); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 378 | virtual bool willCheckAndDispatchMessageEvent( |
[email protected] | ce5064f | 2014-05-07 22:49:20 | [diff] [blame] | 379 | blink::WebLocalFrame* source_frame, |
| 380 | blink::WebFrame* target_frame, |
| 381 | blink::WebSecurityOrigin target_origin, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 382 | blink::WebDOMMessageEvent event); |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 383 | virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame, |
| 384 | const blink::WebURL& url); |
| 385 | virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame); |
| 386 | virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value); |
| 387 | virtual void didLoseWebGLContext(blink::WebLocalFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 388 | int arb_robustness_status_code); |
[email protected] | 5cdd8fd8 | 2014-02-05 20:12:12 | [diff] [blame] | 389 | virtual void forwardInputEvent(const blink::WebInputEvent* event); |
[email protected] | 9ef43adc | 2014-02-19 08:02:15 | [diff] [blame] | 390 | virtual void initializeChildFrame(const blink::WebRect& frame_rect, |
| 391 | float scale_factor); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 392 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 393 | // WebMediaPlayerDelegate implementation: |
| 394 | virtual void DidPlay(blink::WebMediaPlayer* player) OVERRIDE; |
| 395 | virtual void DidPause(blink::WebMediaPlayer* player) OVERRIDE; |
| 396 | virtual void PlayerGone(blink::WebMediaPlayer* player) OVERRIDE; |
| 397 | |
[email protected] | c6bc2033 | 2014-02-28 18:30:39 | [diff] [blame] | 398 | // TODO(nasko): Make all tests in RenderViewImplTest friends and then move |
| 399 | // this back to private member. |
| 400 | void OnNavigate(const FrameMsg_Navigate_Params& params); |
| 401 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 402 | protected: |
| 403 | RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
| 404 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 405 | private: |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 406 | friend class RenderFrameObserver; |
[email protected] | 66bbadaf | 2014-03-28 16:25:54 | [diff] [blame] | 407 | FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, |
| 408 | AccessibilityMessagesQueueWhileSwappedOut); |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 409 | FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 410 | ShouldUpdateSelectionTextFromContextMenuParams); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 411 | FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 412 | OnExtendSelectionAndDelete); |
[email protected] | 66bbadaf | 2014-03-28 16:25:54 | [diff] [blame] | 413 | FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut); |
| 414 | FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 415 | FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 416 | SetEditableSelectionAndComposition); |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 417 | |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 418 | typedef std::map<GURL, double> HostZoomLevels; |
| 419 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 420 | // Functions to add and remove observers for this object. |
| 421 | void AddObserver(RenderFrameObserver* observer); |
| 422 | void RemoveObserver(RenderFrameObserver* observer); |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 423 | |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 424 | void UpdateURL(blink::WebFrame* frame); |
| 425 | |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 426 | // Gets the focused element. If no such element exists then the element will |
| 427 | // be NULL. |
| 428 | blink::WebElement GetFocusedElement(); |
| 429 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 430 | // IPC message handlers ------------------------------------------------------ |
| 431 | // |
| 432 | // The documentation for these functions should be in |
| 433 | // content/common/*_messages.h for the message that the function is handling. |
[email protected] | f76f3223 | 2014-03-11 17:36:17 | [diff] [blame] | 434 | void OnBeforeUnload(); |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 435 | void OnSwapOut(int proxy_routing_id); |
[email protected] | f49722f | 2014-01-30 17:54:50 | [diff] [blame] | 436 | void OnChildFrameProcessGone(); |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 437 | void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); |
| 438 | void OnCompositorFrameSwapped(const IPC::Message& message); |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 439 | void OnShowContextMenu(const gfx::Point& location); |
| 440 | void OnContextMenuClosed(const CustomContextMenuContext& custom_context); |
| 441 | void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, |
| 442 | unsigned action); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 443 | void OnUndo(); |
| 444 | void OnRedo(); |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 445 | void OnCut(); |
| 446 | void OnCopy(); |
| 447 | void OnPaste(); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 448 | void OnPasteAndMatchStyle(); |
| 449 | void OnDelete(); |
| 450 | void OnSelectAll(); |
| 451 | void OnSelectRange(const gfx::Point& start, const gfx::Point& end); |
| 452 | void OnUnselect(); |
[email protected] | 1f3fc1d | 2014-04-03 14:50:17 | [diff] [blame] | 453 | void OnReplace(const base::string16& text); |
| 454 | void OnReplaceMisspelling(const base::string16& text); |
[email protected] | e31b8ebb | 2014-03-07 17:59:34 | [diff] [blame] | 455 | void OnCSSInsertRequest(const std::string& css); |
[email protected] | f13ab89 | 2014-03-12 06:48:52 | [diff] [blame] | 456 | void OnJavaScriptExecuteRequest(const base::string16& javascript, |
| 457 | int id, |
| 458 | bool notify_result); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 459 | void OnSetEditableSelectionOffsets(int start, int end); |
[email protected] | e5e438d6 | 2014-03-27 21:47:16 | [diff] [blame] | 460 | void OnSetCompositionFromExistingText( |
| 461 | int start, int end, |
| 462 | const std::vector<blink::WebCompositionUnderline>& underlines); |
| 463 | void OnExtendSelectionAndDelete(int before, int after); |
[email protected] | 4fed370 | 2014-04-01 09:08:00 | [diff] [blame] | 464 | void OnReload(bool ignore_cache); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 465 | #if defined(OS_MACOSX) |
| 466 | void OnCopyToFindPboard(); |
| 467 | #endif |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 468 | |
[email protected] | 65920f33 | 2014-03-04 21:14:18 | [diff] [blame] | 469 | // Virtual since overridden by WebTestProxy for layout tests. |
| 470 | virtual blink::WebNavigationPolicy DecidePolicyForNavigation( |
| 471 | RenderFrame* render_frame, |
| 472 | blink::WebFrame* frame, |
| 473 | blink::WebDataSource::ExtraData* extraData, |
| 474 | const blink::WebURLRequest& request, |
| 475 | blink::WebNavigationType type, |
| 476 | blink::WebNavigationPolicy default_policy, |
| 477 | bool is_redirect); |
| 478 | void OpenURL(blink::WebFrame* frame, |
| 479 | const GURL& url, |
| 480 | const Referrer& referrer, |
| 481 | blink::WebNavigationPolicy policy); |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 482 | |
[email protected] | ef3adfc | 2014-05-11 00:04:54 | [diff] [blame] | 483 | // Update current main frame's encoding and send it to browser window. |
| 484 | // Since we want to let users see the right encoding info from menu |
| 485 | // before finishing loading, we call the UpdateEncoding in |
| 486 | // a) function:DidCommitLoadForFrame. When this function is called, |
| 487 | // that means we have got first data. In here we try to get encoding |
| 488 | // of page if it has been specified in http header. |
| 489 | // b) function:DidReceiveTitle. When this function is called, |
| 490 | // that means we have got specified title. Because in most of webpages, |
| 491 | // title tags will follow meta tags. In here we try to get encoding of |
| 492 | // page if it has been specified in meta tag. |
| 493 | // c) function:DidFinishDocumentLoadForFrame. When this function is |
| 494 | // called, that means we have got whole html page. In here we should |
| 495 | // finally get right encoding of page. |
| 496 | void UpdateEncoding(blink::WebFrame* frame, |
| 497 | const std::string& encoding_name); |
| 498 | |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 499 | // Dispatches the current state of selection on the webpage to the browser if |
| 500 | // it has changed. |
| 501 | // TODO(varunjain): delete this method once we figure out how to keep |
| 502 | // selection handles in sync with the webpage. |
| 503 | void SyncSelectionIfRequired(); |
| 504 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 505 | // Returns whether |params.selection_text| should be synchronized to the |
| 506 | // browser before bringing up the context menu. Static for testing. |
| 507 | static bool ShouldUpdateSelectionTextFromContextMenuParams( |
| 508 | const base::string16& selection_text, |
| 509 | size_t selection_text_offset, |
| 510 | const gfx::Range& selection_range, |
| 511 | const ContextMenuParams& params); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 512 | |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 513 | bool RunJavaScriptMessage(JavaScriptMessageType type, |
| 514 | const base::string16& message, |
| 515 | const base::string16& default_value, |
| 516 | const GURL& frame_url, |
| 517 | base::string16* result); |
| 518 | |
[email protected] | 457736d | 2014-04-30 15:54:27 | [diff] [blame] | 519 | // Loads the appropriate error page for the specified failure into the frame. |
| 520 | void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request, |
| 521 | const blink::WebURLError& error, |
| 522 | bool replace); |
| 523 | |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 524 | // Initializes |web_user_media_client_|, returning true if successful. Returns |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 525 | // false if it wasn't possible to create a MediaStreamClient (e.g., WebRTC is |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 526 | // disabled) in which case |web_user_media_client_| is NULL. |
| 527 | bool InitializeUserMediaClient(); |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 528 | |
| 529 | blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream( |
| 530 | const blink::WebURL& url, |
| 531 | blink::WebMediaPlayerClient* client); |
| 532 | |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 533 | // Creates a factory object used for creating audio and video renderers. |
| 534 | // The method is virtual so that layouttests can override it. |
| 535 | virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory(); |
| 536 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 537 | #if defined(OS_ANDROID) |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 538 | blink::WebMediaPlayer* CreateAndroidWebMediaPlayer( |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 539 | const blink::WebURL& url, |
| 540 | blink::WebMediaPlayerClient* client); |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 541 | |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 542 | RendererMediaPlayerManager* GetMediaPlayerManager(); |
| 543 | RendererCdmManager* GetCdmManager(); |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 544 | #endif |
| 545 | |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 546 | // Stores the WebLocalFrame we are associated with. |
| 547 | blink::WebLocalFrame* frame_; |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 548 | |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 549 | base::WeakPtr<RenderViewImpl> render_view_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 550 | int routing_id_; |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 551 | bool is_swapped_out_; |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 552 | // RenderFrameProxy exists only when is_swapped_out_ is true. |
| 553 | // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 554 | // RenderFrame. See https://crbug.com/357747. |
| 555 | RenderFrameProxy* render_frame_proxy_; |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 556 | bool is_detaching_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 557 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 558 | #if defined(ENABLE_PLUGINS) |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 559 | // Current text input composition text. Empty if no composition is in |
| 560 | // progress. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 561 | base::string16 pepper_composition_text_; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 562 | #endif |
| 563 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 564 | RendererWebCookieJarImpl cookie_jar_; |
| 565 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 566 | // All the registered observers. |
| 567 | ObserverList<RenderFrameObserver> observers_; |
| 568 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 569 | scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
| 570 | |
[email protected] | 4ecee35 | 2014-03-11 21:12:19 | [diff] [blame] | 571 | // The node that the context menu was pressed over. |
| 572 | blink::WebNode context_menu_node_; |
| 573 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 574 | // External context menu requests we're waiting for. "Internal" |
| 575 | // (WebKit-originated) context menu events will have an ID of 0 and will not |
| 576 | // be in this map. |
| 577 | // |
| 578 | // We don't want to add internal ones since some of the "special" page |
| 579 | // handlers in the browser process just ignore the context menu requests so |
| 580 | // avoid showing context menus, and so this will cause right clicks to leak |
| 581 | // entries in this map. Most users of the custom context menu (e.g. Pepper |
| 582 | // plugins) are normally only on "regular" pages and the regular pages will |
| 583 | // always respond properly to the request, so we don't have to worry so |
| 584 | // much about leaks. |
| 585 | IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_; |
| 586 | |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 587 | // The text selection the last time DidChangeSelection got called. May contain |
| 588 | // additional characters before and after the selected text, for IMEs. The |
| 589 | // portion of this string that is the actual selected text starts at index |
| 590 | // |selection_range_.GetMin() - selection_text_offset_| and has length |
| 591 | // |selection_range_.length()|. |
| 592 | base::string16 selection_text_; |
| 593 | // The offset corresponding to the start of |selection_text_| in the document. |
| 594 | size_t selection_text_offset_; |
| 595 | // Range over the document corresponding to the actual selected text (which |
| 596 | // could correspond to a substring of |selection_text_|; see above). |
| 597 | gfx::Range selection_range_; |
| 598 | // Used to inform didChangeSelection() when it is called in the context |
| 599 | // of handling a InputMsg_SelectRange IPC. |
| 600 | bool handling_select_range_; |
| 601 | |
[email protected] | 2626d14 | 2014-04-22 17:24:02 | [diff] [blame] | 602 | // The next group of objects all implement RenderFrameObserver, so are deleted |
| 603 | // along with the RenderFrame automatically. This is why we just store weak |
| 604 | // references. |
| 605 | |
| 606 | // Holds a reference to the service which provides desktop notifications. |
| 607 | NotificationProvider* notification_provider_; |
| 608 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 609 | blink::WebUserMediaClient* web_user_media_client_; |
| 610 | |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 611 | #if defined(OS_ANDROID) |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 612 | // These manage all media players and CDMs in this render frame for |
| 613 | // communicating with the real media player and CDM objects in the browser |
| 614 | // process. It's okay to use raw pointers since they are RenderFrameObservers. |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 615 | RendererMediaPlayerManager* media_player_manager_; |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 616 | RendererCdmManager* cdm_manager_; |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 617 | #endif |
| 618 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 619 | base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
| 620 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 621 | DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 622 | }; |
| 623 | |
| 624 | } // namespace content |
| 625 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 626 | #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |