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