1 // Copyright (c) 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/process/kill.h"
17 #include "content/browser/renderer_host/render_widget_host_impl.h"
18 #include "content/browser/site_instance_impl.h"
19 #include "content/common/drag_event_source_info.h"
20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/render_view_host.h"
22 #include "content/public/common/window_container_type.h"
23 #include "net/base/load_states.h"
24 #include "third_party/WebKit/public/web/WebAXEnums.h"
25 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
26 #include "third_party/WebKit/public/web/WebPopupType.h"
27 #include "third_party/WebKit/public/web/WebTextDirection.h"
28 #include "third_party/skia/include/core/SkColor.h"
29 #include "ui/accessibility/ax_node_data.h"
30 #include "ui/base/window_open_disposition.h"
33 class FrameMsg_Navigate;
34 struct AccessibilityHostMsg_EventParams;
35 struct AccessibilityHostMsg_LocationChangeParams;
36 struct MediaPlayerAction;
37 struct ViewHostMsg_CreateWindow_Params;
38 struct ViewHostMsg_ShowPopup_Params;
39 struct FrameMsg_Navigate_Params;
40 struct ViewMsg_PostMessage_Params;
52 struct SelectedFileInfo;
57 class BrowserMediaPlayerManager;
58 class ChildProcessSecurityPolicyImpl;
60 class RenderWidgetHostDelegate;
61 class SessionStorageNamespace;
62 class SessionStorageNamespaceImpl;
63 class TestRenderViewHost;
65 struct FileChooserParams;
67 #if defined(COMPILER_MSVC)
68 // RenderViewHostImpl is the bottom of a diamond-shaped hierarchy,
69 // with RenderWidgetHost at the root. VS warns when methods from the
70 // root are overridden in only one of the base classes and not both
71 // (in this case, RenderWidgetHostImpl provides implementations of
72 // many of the methods). This is a silly warning when dealing with
73 // pure virtual methods that only have a single implementation in the
74 // hierarchy above this class, and is safe to ignore in this case.
76 #pragma warning(disable: 4250)
79 // This implements the RenderViewHost interface that is exposed to
80 // embedders of content, and adds things only visible to content.
82 // The exact API of this object needs to be more thoroughly designed. Right
83 // now it mimics what WebContentsImpl exposed, which is a fairly large API and
84 // may contain things that are not relevant to a common subset of views. See
85 // also the comment in render_view_host_delegate.h about the size and scope of
88 // Right now, the concept of page navigation (both top level and frame) exists
89 // in the WebContentsImpl still, so if you instantiate one of these elsewhere,
90 // you will not be able to traverse pages back and forward. We need to determine
91 // if we want to bring that and other functionality down into this object so it
92 // can be shared by others.
93 class CONTENT_EXPORT RenderViewHostImpl
94 : public RenderViewHost,
95 public RenderWidgetHostImpl {
97 // Keeps track of the state of the RenderViewHostImpl, particularly with
98 // respect to swap out.
99 enum RenderViewHostImplState {
100 // The standard state for a RVH handling the communication with a
103 // The RVH has sent the SwapOut request to the renderer, but has not
104 // received the SwapOutACK yet. The new page has not been committed yet
106 STATE_WAITING_FOR_UNLOAD_ACK,
107 // The RVH received the SwapOutACK from the RenderView, but the new page has
108 // not been committed yet.
109 STATE_WAITING_FOR_COMMIT,
110 // The RVH is waiting for the CloseACK from the RenderView.
111 STATE_WAITING_FOR_CLOSE,
112 // The RVH has not received the SwapOutACK yet, but the new page has
113 // committed in a different RVH. The number of active views of the RVH
114 // SiteInstanceImpl is not zero. Upon reception of the SwapOutACK, the RVH
115 // will be swapped out.
116 STATE_PENDING_SWAP_OUT,
117 // The RVH has not received the SwapOutACK yet, but the new page has
118 // committed in a different RVH. The number of active views of the RVH
119 // SiteInstanceImpl is zero. Upon reception of the SwapOutACK, the RVH will
121 STATE_PENDING_SHUTDOWN,
122 // The RVH is swapped out, and it is being used as a placeholder to allow
123 // for cross-process communication.
126 // Helper function to determine whether the RVH state should contribute to the
127 // number of active views of a SiteInstance or not.
128 static bool IsRVHStateActive(RenderViewHostImplState rvh_state);
130 // Convenience function, just like RenderViewHost::FromID.
131 static RenderViewHostImpl* FromID(int render_process_id, int render_view_id);
133 // |routing_id| could be a valid route id, or it could be MSG_ROUTING_NONE, in
134 // which case RenderWidgetHost will create a new one. |swapped_out| indicates
135 // whether the view should initially be swapped out (e.g., for an opener
136 // frame being rendered by another process). |hidden| indicates whether the
137 // view is initially hidden or visible.
139 // The |session_storage_namespace| parameter allows multiple render views and
140 // WebContentses to share the same session storage (part of the WebStorage
141 // spec) space. This is useful when restoring contentses, but most callers
142 // should pass in NULL which will cause a new SessionStorageNamespace to be
145 SiteInstance* instance,
146 RenderViewHostDelegate* delegate,
147 RenderWidgetHostDelegate* widget_delegate,
149 int main_frame_routing_id,
152 virtual ~RenderViewHostImpl();
154 // RenderViewHost implementation.
155 virtual RenderFrameHost* GetMainFrame() OVERRIDE;
156 virtual void AllowBindings(int binding_flags) OVERRIDE;
157 virtual void ClearFocusedElement() OVERRIDE;
158 virtual bool IsFocusedElementEditable() OVERRIDE;
159 virtual void ClosePage() OVERRIDE;
160 virtual void CopyImageAt(int x, int y) OVERRIDE;
161 virtual void SaveImageAt(int x, int y) OVERRIDE;
162 virtual void DirectoryEnumerationFinished(
164 const std::vector<base::FilePath>& files) OVERRIDE;
165 virtual void DisableScrollbarsForThreshold(const gfx::Size& size) OVERRIDE;
166 virtual void DragSourceEndedAt(
167 int client_x, int client_y, int screen_x, int screen_y,
168 blink::WebDragOperation operation) OVERRIDE;
169 virtual void DragSourceSystemDragEnded() OVERRIDE;
170 virtual void DragTargetDragEnter(
171 const DropData& drop_data,
172 const gfx::Point& client_pt,
173 const gfx::Point& screen_pt,
174 blink::WebDragOperationsMask operations_allowed,
175 int key_modifiers) OVERRIDE;
176 virtual void DragTargetDragOver(
177 const gfx::Point& client_pt,
178 const gfx::Point& screen_pt,
179 blink::WebDragOperationsMask operations_allowed,
180 int key_modifiers) OVERRIDE;
181 virtual void DragTargetDragLeave() OVERRIDE;
182 virtual void DragTargetDrop(const gfx::Point& client_pt,
183 const gfx::Point& screen_pt,
184 int key_modifiers) OVERRIDE;
185 virtual void EnableAutoResize(const gfx::Size& min_size,
186 const gfx::Size& max_size) OVERRIDE;
187 virtual void DisableAutoResize(const gfx::Size& new_size) OVERRIDE;
188 virtual void EnablePreferredSizeMode() OVERRIDE;
189 virtual void ExecuteMediaPlayerActionAtLocation(
190 const gfx::Point& location,
191 const blink::WebMediaPlayerAction& action) OVERRIDE;
192 virtual void ExecutePluginActionAtLocation(
193 const gfx::Point& location,
194 const blink::WebPluginAction& action) OVERRIDE;
195 virtual void ExitFullscreen() OVERRIDE;
196 virtual void FilesSelectedInChooser(
197 const std::vector<ui::SelectedFileInfo>& files,
198 FileChooserParams::Mode permissions) OVERRIDE;
199 virtual RenderViewHostDelegate* GetDelegate() const OVERRIDE;
200 virtual int GetEnabledBindings() const OVERRIDE;
201 virtual SiteInstance* GetSiteInstance() const OVERRIDE;
202 virtual bool IsRenderViewLive() const OVERRIDE;
203 virtual void NotifyMoveOrResizeStarted() OVERRIDE;
204 virtual void SetWebUIProperty(const std::string& name,
205 const std::string& value) OVERRIDE;
206 virtual void Zoom(PageZoom zoom) OVERRIDE;
207 virtual void SyncRendererPrefs() OVERRIDE;
208 virtual WebPreferences GetWebkitPreferences() OVERRIDE;
209 virtual void UpdateWebkitPreferences(
210 const WebPreferences& prefs) OVERRIDE;
211 virtual void GetAudioOutputControllers(
212 const GetAudioOutputControllersCallback& callback) const OVERRIDE;
213 virtual void SetWebUIHandle(mojo::ScopedMessagePipeHandle handle) OVERRIDE;
215 #if defined(OS_ANDROID)
216 virtual void ActivateNearestFindResult(int request_id,
219 virtual void RequestFindMatchRects(int current_version) OVERRIDE;
222 void set_delegate(RenderViewHostDelegate* d) {
223 CHECK(d); // http://crbug.com/82827
227 // Set up the RenderView child process. Virtual because it is overridden by
228 // TestRenderViewHost. If the |frame_name| parameter is non-empty, it is used
229 // as the name of the new top-level frame.
230 // The |opener_route_id| parameter indicates which RenderView created this
231 // (MSG_ROUTING_NONE if none). If |max_page_id| is larger than -1, the
232 // RenderView is told to start issuing page IDs at |max_page_id| + 1.
233 // |window_was_created_with_opener| is true if this top-level frame was
234 // created with an opener. (The opener may have been closed since.)
235 virtual bool CreateRenderView(const base::string16& frame_name,
238 bool window_was_created_with_opener);
240 base::TerminationStatus render_view_termination_status() const {
241 return render_view_termination_status_;
244 // Returns the content specific prefs for this RenderViewHost.
245 WebPreferences GetWebkitPrefs(const GURL& url);
247 // Sends the given navigation message. Use this rather than sending it
248 // yourself since this does the internal bookkeeping described below. This
249 // function takes ownership of the provided message pointer.
251 // If a cross-site request is in progress, we may be suspended while waiting
252 // for the onbeforeunload handler, so this function might buffer the message
253 // rather than sending it.
254 // TODO(nasko): Remove this method once all callers are converted to use
255 // RenderFrameHostImpl.
256 void Navigate(const FrameMsg_Navigate_Params& message);
258 // Load the specified URL, this is a shortcut for Navigate().
259 // TODO(nasko): Remove this method once all callers are converted to use
260 // RenderFrameHostImpl.
261 void NavigateToURL(const GURL& url);
263 // Returns whether navigation messages are currently suspended for this
264 // RenderViewHost. Only true during a cross-site navigation, while waiting
265 // for the onbeforeunload handler.
266 bool are_navigations_suspended() const { return navigations_suspended_; }
268 // Suspends (or unsuspends) any navigation messages from being sent from this
269 // RenderViewHost. This is called when a pending RenderViewHost is created
270 // for a cross-site navigation, because we must suspend any navigations until
271 // we hear back from the old renderer's onbeforeunload handler. Note that it
272 // is important that only one navigation event happen after calling this
273 // method with |suspend| equal to true. If |suspend| is false and there is
274 // a suspended_nav_message_, this will send the message. This function
275 // should only be called to toggle the state; callers should check
276 // are_navigations_suspended() first. If |suspend| is false, the time that the
277 // user decided the navigation should proceed should be passed as
279 void SetNavigationsSuspended(bool suspend,
280 const base::TimeTicks& proceed_time);
282 // Clears any suspended navigation state after a cross-site navigation is
283 // canceled or suspended. This is important if we later return to this
285 void CancelSuspendedNavigations();
287 // Whether this RenderViewHost has been swapped out to be displayed by a
288 // different process.
289 bool IsSwappedOut() const { return rvh_state_ == STATE_SWAPPED_OUT; }
291 // The current state of this RVH.
292 RenderViewHostImplState rvh_state() const { return rvh_state_; }
294 // Tells the renderer that this RenderView will soon be swapped out, and thus
295 // not to create any new modal dialogs until it happens. This must be done
296 // separately so that the PageGroupLoadDeferrers of any current dialogs are no
297 // longer on the stack when we attempt to swap it out.
298 void SuppressDialogsUntilSwapOut();
300 // Called when either the SwapOut request has been acknowledged or has timed
302 void OnSwappedOut(bool timed_out);
304 // Called when the RenderFrameHostManager has swapped in a new
305 // RenderFrameHost. Should |this| RVH switch to the pending shutdown state,
306 // |pending_delete_on_swap_out| will be executed upon reception of the
307 // SwapOutACK, or when the unload timer times out.
308 void WasSwappedOut(const base::Closure& pending_delete_on_swap_out);
310 // Set |this| as pending shutdown. |on_swap_out| will be called
311 // when the SwapOutACK is received, or when the unload timer times out.
312 void SetPendingShutdown(const base::Closure& on_swap_out);
314 // Close the page ignoring whether it has unload events registers.
315 // This is called after the beforeunload and unload events have fired
316 // and the user has agreed to continue with closing the page.
317 void ClosePageIgnoringUnloadEvents();
319 // Returns whether this RenderViewHost has an outstanding cross-site request.
320 // Cleared when we hear the response and start to swap out the old
321 // RenderViewHost, or if we hear a commit here without a network request.
322 bool HasPendingCrossSiteRequest();
324 // Sets whether this RenderViewHost has an outstanding cross-site request,
325 // for which another renderer will need to run an onunload event handler.
326 // This is called before the first navigation event for this RenderViewHost,
327 // and cleared when we hear the response or commit.
328 void SetHasPendingCrossSiteRequest(bool has_pending_request);
330 // Tells the renderer view to focus the first (last if reverse is true) node.
331 void SetInitialFocus(bool reverse);
333 // Get html data by serializing all frames of current page with lists
334 // which contain all resource links that have local copy.
335 // The parameter links contain original URLs of all saved links.
336 // The parameter local_paths contain corresponding local file paths of
337 // all saved links, which matched with vector:links one by one.
338 // The parameter local_directory_name is relative path of directory which
339 // contain all saved auxiliary files included all sub frames and resouces.
340 void GetSerializedHtmlDataForCurrentPageWithLocalLinks(
341 const std::vector<GURL>& links,
342 const std::vector<base::FilePath>& local_paths,
343 const base::FilePath& local_directory_name);
345 // Notifies the RenderViewHost that its load state changed.
346 void LoadStateChanged(const GURL& url,
347 const net::LoadStateWithParam& load_state,
348 uint64 upload_position,
351 bool SuddenTerminationAllowed() const;
352 void set_sudden_termination_allowed(bool enabled) {
353 sudden_termination_allowed_ = enabled;
356 // RenderWidgetHost public overrides.
357 virtual void Init() OVERRIDE;
358 virtual void Shutdown() OVERRIDE;
359 virtual bool IsRenderView() const OVERRIDE;
360 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
361 virtual void GotFocus() OVERRIDE;
362 virtual void LostCapture() OVERRIDE;
363 virtual void LostMouseLock() OVERRIDE;
364 virtual void ForwardMouseEvent(
365 const blink::WebMouseEvent& mouse_event) OVERRIDE;
366 virtual void OnPointerEventActivate() OVERRIDE;
367 virtual void ForwardKeyboardEvent(
368 const NativeWebKeyboardEvent& key_event) OVERRIDE;
369 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
371 // Creates a new RenderView with the given route id.
372 void CreateNewWindow(
374 int main_frame_route_id,
375 const ViewHostMsg_CreateWindow_Params& params,
376 SessionStorageNamespace* session_storage_namespace);
378 // Creates a new RenderWidget with the given route id. |popup_type| indicates
379 // if this widget is a popup and what kind of popup it is (select, autofill).
380 void CreateNewWidget(int route_id, blink::WebPopupType popup_type);
382 // Creates a full screen RenderWidget.
383 void CreateNewFullscreenWidget(int route_id);
385 #if defined(OS_MACOSX)
386 // Select popup menu related methods (for external popup menus).
387 void DidSelectPopupMenuItem(int selected_index);
388 void DidCancelPopupMenu();
391 #if defined(OS_ANDROID)
392 BrowserMediaPlayerManager* media_player_manager() {
393 return media_player_manager_.get();
396 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices);
397 void DidCancelPopupMenu();
400 int main_frame_routing_id() const {
401 return main_frame_routing_id_;
404 // Set the opener to null in the renderer process.
407 // Turn on accessibility testing. The given callback will be run
408 // every time an accessibility notification is received from the
409 // renderer process, and the accessibility tree it sent can be
410 // retrieved using accessibility_tree_for_testing().
411 void SetAccessibilityCallbackForTesting(
412 const base::Callback<void(ui::AXEvent)>& callback);
414 // Only valid if SetAccessibilityCallbackForTesting was called and
415 // the callback was run at least once. Returns a snapshot of the
416 // accessibility tree received from the renderer as of the last time
417 // an accessibility notification was received.
418 const ui::AXTree& ax_tree_for_testing() {
419 CHECK(ax_tree_.get());
420 return *ax_tree_.get();
423 // Set accessibility callbacks.
424 void SetAccessibilityLayoutCompleteCallbackForTesting(
425 const base::Closure& callback);
426 void SetAccessibilityLoadCompleteCallbackForTesting(
427 const base::Closure& callback);
428 void SetAccessibilityOtherCallbackForTesting(
429 const base::Closure& callback);
431 bool is_waiting_for_beforeunload_ack() {
432 return is_waiting_for_beforeunload_ack_;
435 // Whether the RVH is waiting for the unload ack from the renderer.
436 bool IsWaitingForUnloadACK() const;
438 // Update the FrameTree to use this RenderViewHost's main frame
439 // RenderFrameHost. Called when the RenderViewHost is committed.
441 // TODO(ajwong): Remove once RenderViewHost no longer owns the main frame
443 void AttachToFrameTree();
445 // Increases the refcounting on this RVH. This is done by the FrameTree on
446 // creation of a RenderFrameHost.
447 void increment_ref_count() { ++frames_ref_count_; }
449 // Decreases the refcounting on this RVH. This is done by the FrameTree on
450 // destruction of a RenderFrameHost.
451 void decrement_ref_count() { --frames_ref_count_; }
453 // Returns the refcount on this RVH, that is the number of RenderFrameHosts
454 // currently using it.
455 int ref_count() { return frames_ref_count_; }
457 // NOTE: Do not add functions that just send an IPC message that are called in
458 // one or two places. Have the caller send the IPC message directly (unless
459 // the caller places are in different platforms, in which case it's better
460 // to keep them consistent).
463 // RenderWidgetHost protected overrides.
464 virtual void OnUserGesture() OVERRIDE;
465 virtual void NotifyRendererUnresponsive() OVERRIDE;
466 virtual void NotifyRendererResponsive() OVERRIDE;
467 virtual void OnRenderAutoResized(const gfx::Size& size) OVERRIDE;
468 virtual void RequestToLockMouse(bool user_gesture,
469 bool last_unlocked_by_target) OVERRIDE;
470 virtual bool IsFullscreen() const OVERRIDE;
471 virtual void OnFocus() OVERRIDE;
472 virtual void OnBlur() OVERRIDE;
474 // IPC message handlers.
475 void OnShowView(int route_id,
476 WindowOpenDisposition disposition,
477 const gfx::Rect& initial_pos,
479 void OnShowWidget(int route_id, const gfx::Rect& initial_pos);
480 void OnShowFullscreenWidget(int route_id);
481 void OnRunModal(int opener_id, IPC::Message* reply_msg);
482 void OnRenderViewReady();
483 void OnRenderProcessGone(int status, int error_code);
484 void OnUpdateState(int32 page_id, const PageState& state);
485 void OnUpdateTitle(int32 page_id,
486 const base::string16& title,
487 blink::WebTextDirection title_direction);
488 void OnUpdateEncoding(const std::string& encoding);
489 void OnUpdateTargetURL(int32 page_id, const GURL& url);
491 void OnRequestMove(const gfx::Rect& pos);
492 void OnDidChangeLoadProgress(double load_progress);
493 void OnDocumentAvailableInMainFrame();
494 void OnToggleFullscreen(bool enter_fullscreen);
495 void OnDidContentsPreferredSizeChange(const gfx::Size& new_size);
496 void OnDidChangeScrollOffset();
497 void OnDidChangeScrollOffsetPinningForMainFrame(bool is_pinned_to_left,
498 bool is_pinned_to_right);
499 void OnDidChangeNumWheelEvents(int count);
500 #if defined(OS_ANDROID)
501 void OnSelectionRootBoundsChanged(const gfx::Rect& bounds);
503 void OnPasteFromSelectionClipboard();
504 void OnRouteCloseEvent();
505 void OnRouteMessageEvent(const ViewMsg_PostMessage_Params& params);
506 void OnStartDragging(const DropData& drop_data,
507 blink::WebDragOperationsMask operations_allowed,
508 const SkBitmap& bitmap,
509 const gfx::Vector2d& bitmap_offset_in_dip,
510 const DragEventSourceInfo& event_info);
511 void OnUpdateDragCursor(blink::WebDragOperation drag_operation);
512 void OnTargetDropACK();
513 void OnTakeFocus(bool reverse);
514 void OnFocusedNodeChanged(bool is_editable_node);
515 void OnUpdateInspectorSetting(const std::string& key,
516 const std::string& value);
517 void OnClosePageACK();
518 void OnAccessibilityEvents(
519 const std::vector<AccessibilityHostMsg_EventParams>& params);
520 void OnAccessibilityLocationChanges(
521 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
522 void OnDidZoomURL(double zoom_level, bool remember, const GURL& url);
523 void OnRunFileChooser(const FileChooserParams& params);
524 void OnFocusedNodeTouched(bool editable);
526 #if defined(OS_MACOSX) || defined(OS_ANDROID)
527 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params);
532 // TODO(nasko): Temporarily friend RenderFrameHostImpl, so we don't duplicate
533 // utility functions and state needed in both classes, while we move frame
534 // specific code away from this class.
535 friend class RenderFrameHostImpl;
536 friend class TestRenderViewHost;
537 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost);
538 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane);
540 // TODO(creis): Move to a private namespace on RenderFrameHostImpl.
541 // Delay to wait on closing the WebContents for a beforeunload/unload handler
543 static const int kUnloadTimeoutMS;
545 // Updates the state of this RenderViewHost and clears any waiting state
546 // that is no longer relevant.
547 void SetState(RenderViewHostImplState rvh_state);
549 bool CanAccessFilesOfPageState(const PageState& state) const;
551 // The number of RenderFrameHosts which have a reference to this RVH.
552 int frames_ref_count_;
554 // Our delegate, which wants to know about changes in the RenderView.
555 RenderViewHostDelegate* delegate_;
557 // The SiteInstance associated with this RenderViewHost. All pages drawn
558 // in this RenderViewHost are part of this SiteInstance. Should not change
560 scoped_refptr<SiteInstanceImpl> instance_;
562 // true if we are currently waiting for a response for drag context
564 bool waiting_for_drag_context_response_;
566 // A bitwise OR of bindings types that have been enabled for this RenderView.
567 // See BindingsPolicy for details.
568 int enabled_bindings_;
570 // Whether we should buffer outgoing Navigate messages rather than sending
571 // them. This will be true when a RenderViewHost is created for a cross-site
572 // request, until we hear back from the onbeforeunload handler of the old
574 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
575 bool navigations_suspended_;
577 // We only buffer the params for a suspended navigation while we have a
578 // pending RVH for a WebContentsImpl. There will only ever be one suspended
579 // navigation, because WebContentsImpl will destroy the pending RVH and create
580 // a new one if a second navigation occurs.
581 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
582 scoped_ptr<FrameMsg_Navigate_Params> suspended_nav_params_;
584 // The current state of this RVH.
585 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
586 RenderViewHostImplState rvh_state_;
588 // Routing ID for the main frame's RenderFrameHost.
589 int main_frame_routing_id_;
591 // If we were asked to RunModal, then this will hold the reply_msg that we
592 // must return to the renderer to unblock it.
593 IPC::Message* run_modal_reply_msg_;
594 // This will hold the routing id of the RenderView that opened us.
595 int run_modal_opener_id_;
597 // Set to true when there is a pending ViewMsg_ShouldClose message. This
598 // ensures we don't spam the renderer with multiple beforeunload requests.
599 // When either this value or IsWaitingForUnloadACK is true, the value of
600 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
601 // cross-site transition or a tab close attempt.
602 // TODO(clamy): Remove this boolean and add one more state to the state
604 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
605 bool is_waiting_for_beforeunload_ack_;
607 // Valid only when is_waiting_for_beforeunload_ack_ or
608 // IsWaitingForUnloadACK is true. This tells us if the unload request
609 // is for closing the entire tab ( = false), or only this RenderViewHost in
610 // the case of a cross-site transition ( = true).
611 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
612 bool unload_ack_is_for_cross_site_transition_;
614 // Accessibility callback for testing.
615 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_;
617 // The most recently received accessibility tree - for testing only.
618 scoped_ptr<ui::AXTree> ax_tree_;
620 // True if the render view can be shut down suddenly.
621 bool sudden_termination_allowed_;
623 // The termination status of the last render view that terminated.
624 base::TerminationStatus render_view_termination_status_;
626 // Set to true if we requested the on screen keyboard to be displayed.
627 bool virtual_keyboard_requested_;
629 #if defined(OS_ANDROID)
630 // Manages all the android mediaplayer objects and handling IPCs for video.
631 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_;
634 // Used to swap out or shutdown this RVH when the unload event is taking too
635 // long to execute, depending on the number of active views in the
637 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
638 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_;
640 // Called after receiving the SwapOutACK when the RVH is in state pending
641 // shutdown. Also called if the unload timer times out.
642 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
643 base::Closure pending_shutdown_on_swap_out_;
645 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_;
647 // True if the current focused element is editable.
648 bool is_focused_element_editable_;
650 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
653 #if defined(COMPILER_MSVC)
657 } // namespace content
659 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_