Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 616133002: Make RenderFrame(Host) own a RenderWidget(Host). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format, changed WebWidget creation Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 class CrossProcessFrameConnector; 53 class CrossProcessFrameConnector;
54 class CrossSiteTransferringRequest; 54 class CrossSiteTransferringRequest;
55 class FrameTree; 55 class FrameTree;
56 class FrameTreeNode; 56 class FrameTreeNode;
57 class PermissionServiceContext; 57 class PermissionServiceContext;
58 class RenderFrameHostDelegate; 58 class RenderFrameHostDelegate;
59 class RenderFrameProxyHost; 59 class RenderFrameProxyHost;
60 class RenderProcessHost; 60 class RenderProcessHost;
61 class RenderViewHostImpl; 61 class RenderViewHostImpl;
62 class RenderWidgetHostDelegate;
62 class RenderWidgetHostImpl; 63 class RenderWidgetHostImpl;
64 class RenderWidgetHostView;
63 class StreamHandle; 65 class StreamHandle;
64 class TimeoutMonitor; 66 class TimeoutMonitor;
65 struct CommitNavigationParams; 67 struct CommitNavigationParams;
66 struct CommonNavigationParams; 68 struct CommonNavigationParams;
67 struct ContextMenuParams; 69 struct ContextMenuParams;
68 struct GlobalRequestID; 70 struct GlobalRequestID;
69 struct Referrer; 71 struct Referrer;
70 struct ResourceResponse; 72 struct ResourceResponse;
71 struct TransitionLayerData; 73 struct TransitionLayerData;
72 74
73 // Flag arguments for RenderFrameHost creation. 75 // Flag arguments for RenderFrameHost creation.
74 enum CreateRenderFrameFlags { 76 enum CreateRenderFrameFlags {
75 // The RFH will be initially placed on the swapped out hosts list. 77 // The RFH will be initially placed on the swapped out hosts list.
76 CREATE_RF_SWAPPED_OUT = 1 << 0, 78 CREATE_RF_SWAPPED_OUT = 1 << 0,
77 // The new RenderFrame is being created for a navigation of the 79 // The new RenderFrame is being created for a navigation of the
78 // top-level frame. 80 // top-level frame.
79 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1, 81 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1,
80 // The RenderFrame is initially hidden. 82 // The RenderFrame is initially hidden.
81 CREATE_RF_HIDDEN = 1 << 2 83 CREATE_RF_HIDDEN = 1 << 2,
84 // The RenderFrameHost will have a new RenderWidgetHost created and
85 // attached to it. This is used when the RenderFrameHost is the root
86 // of a subtree of frames that are being rendered in the same process.
Charlie Reis 2014/12/18 18:04:13 Is this another way of saying it's used for subfra
kenrb 2015/01/05 21:15:30 I have changed it. The fact that a single node wit
87 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
82 }; 88 };
83 89
84 class CONTENT_EXPORT RenderFrameHostImpl 90 class CONTENT_EXPORT RenderFrameHostImpl
85 : public RenderFrameHost, 91 : public RenderFrameHost,
86 public BrowserAccessibilityDelegate { 92 public BrowserAccessibilityDelegate {
87 public: 93 public:
88 // Keeps track of the state of the RenderFrameHostImpl, particularly with 94 // Keeps track of the state of the RenderFrameHostImpl, particularly with
89 // respect to swap out. 95 // respect to swap out.
90 enum RenderFrameHostImplState { 96 enum RenderFrameHostImplState {
91 // The standard state for a RFH handling the communication with an active 97 // The standard state for a RFH handling the communication with an active
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // after they are blocked in RenderWidgetHelper::CreateNewWindow. 188 // after they are blocked in RenderWidgetHelper::CreateNewWindow.
183 void Init(); 189 void Init();
184 190
185 int routing_id() const { return routing_id_; } 191 int routing_id() const { return routing_id_; }
186 void OnCreateChildFrame(int new_routing_id, 192 void OnCreateChildFrame(int new_routing_id,
187 const std::string& frame_name); 193 const std::string& frame_name);
188 194
189 RenderViewHostImpl* render_view_host() { return render_view_host_; } 195 RenderViewHostImpl* render_view_host() { return render_view_host_; }
190 RenderFrameHostDelegate* delegate() { return delegate_; } 196 RenderFrameHostDelegate* delegate() { return delegate_; }
191 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 197 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
192 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in 198
193 // the future, so update this accessor to return the right pointer. 199 // This is called to create RenderWidgetHosts for out-of-process iframes.
200 void CreateRenderWidgetHost(RenderWidgetHostDelegate* delegate, bool hidden);
Charlie Reis 2014/12/18 18:04:13 Can we move this closer to CreateRenderFrame, rath
kenrb 2015/01/05 21:15:30 Done.
201
202 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
203 // or else it returns a pointer to the RenderViewHost (which inherits
Charlie Reis 2014/12/18 18:04:13 In a grandchild case like A-embed-B1-embed-B2, wha
kenrb 2015/01/05 21:15:30 We discussed this a couple of months ago, there is
Charlie Reis 2015/01/06 00:04:57 I'm ok with returning nullptr if the RFH doesn't h
kenrb 2015/01/06 17:39:03 Done.
204 // RenderWidgetHost).
194 RenderWidgetHostImpl* GetRenderWidgetHost(); 205 RenderWidgetHostImpl* GetRenderWidgetHost();
195 206
207 // This returns the RenderWidgetHostView that can be used to control
208 // focus and visibility for this frame.
209 RenderWidgetHostView* GetView();
210
196 // This function is called when this is a swapped out RenderFrameHost that 211 // This function is called when this is a swapped out RenderFrameHost that
197 // lives in the same process as the parent frame. The 212 // lives in the same process as the parent frame. The
198 // |cross_process_frame_connector| allows the non-swapped-out 213 // |cross_process_frame_connector| allows the non-swapped-out
199 // RenderFrameHost for a frame to communicate with the parent process 214 // RenderFrameHost for a frame to communicate with the parent process
200 // so that it may composite drawing data. 215 // so that it may composite drawing data.
201 // 216 //
202 // Ownership is not transfered. 217 // Ownership is not transfered.
203 void set_cross_process_frame_connector( 218 void set_cross_process_frame_connector(
204 CrossProcessFrameConnector* cross_process_frame_connector) { 219 CrossProcessFrameConnector* cross_process_frame_connector) {
205 cross_process_frame_connector_ = cross_process_frame_connector; 220 cross_process_frame_connector_ = cross_process_frame_connector;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 401
387 protected: 402 protected:
388 friend class RenderFrameHostFactory; 403 friend class RenderFrameHostFactory;
389 404
390 // |flags| is a combination of CreateRenderFrameFlags. 405 // |flags| is a combination of CreateRenderFrameFlags.
391 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 406 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
392 // should be the abstraction needed here, but we need RenderViewHost to pass 407 // should be the abstraction needed here, but we need RenderViewHost to pass
393 // into WebContentsObserver::FrameDetached for now. 408 // into WebContentsObserver::FrameDetached for now.
394 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 409 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
395 RenderFrameHostDelegate* delegate, 410 RenderFrameHostDelegate* delegate,
411 RenderWidgetHostDelegate* rwh_delegate,
396 FrameTree* frame_tree, 412 FrameTree* frame_tree,
397 FrameTreeNode* frame_tree_node, 413 FrameTreeNode* frame_tree_node,
398 int routing_id, 414 int routing_id,
399 int flags); 415 int flags);
400 416
401 private: 417 private:
402 friend class TestRenderFrameHost; 418 friend class TestRenderFrameHost;
403 friend class TestRenderViewHost; 419 friend class TestRenderViewHost;
404 420
405 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); 421 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 // messages from the renderer requesting DOM manipulation. 541 // messages from the renderer requesting DOM manipulation.
526 FrameTree* frame_tree_; 542 FrameTree* frame_tree_;
527 543
528 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. 544 // The FrameTreeNode which this RenderFrameHostImpl is hosted in.
529 FrameTreeNode* frame_tree_node_; 545 FrameTreeNode* frame_tree_node_;
530 546
531 // The mapping of pending JavaScript calls created by 547 // The mapping of pending JavaScript calls created by
532 // ExecuteJavaScript and their corresponding callbacks. 548 // ExecuteJavaScript and their corresponding callbacks.
533 std::map<int, JavaScriptResultCallback> javascript_callbacks_; 549 std::map<int, JavaScriptResultCallback> javascript_callbacks_;
534 550
551 // Map from notification_id to a callback to cancel them.
Charlie Reis 2014/12/18 18:04:13 This is a bit generic. Can you say what these not
kenrb 2015/01/05 21:15:30 This isn't my code, I assume a merge resolution er
552 std::map<int, base::Closure> cancel_notification_callbacks_;
553
554 // RenderFrameHosts that need management of the rendering and input events
555 // for their frame subtrees require RenderWidgetHosts. This typically
556 // means frames that are rendered in different processes from their parent
557 // frames.
558 // TODO(kenrb): Later this will also be used on the top-level frame.
Charlie Reis 2014/12/18 18:04:13 ... when RenderFrameHost owns its RenderViewHost.
kenrb 2015/01/05 21:15:30 I was thinking when RenderViewHost and RenderWidge
559 scoped_ptr<RenderWidgetHostImpl> render_widget_host_;
560
535 int routing_id_; 561 int routing_id_;
536 562
537 // The current state of this RenderFrameHost. 563 // The current state of this RenderFrameHost.
538 RenderFrameHostImplState rfh_state_; 564 RenderFrameHostImplState rfh_state_;
539 565
540 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 566 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
541 // the renderer process. Currently only used for subframes. 567 // the renderer process. Currently only used for subframes.
542 // TODO(creis): Use this for main frames as well when RVH goes away. 568 // TODO(creis): Use this for main frames as well when RVH goes away.
543 bool render_frame_created_; 569 bool render_frame_created_;
544 570
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 639
614 // NOTE: This must be the last member. 640 // NOTE: This must be the last member.
615 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 641 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
616 642
617 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 643 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
618 }; 644 };
619 645
620 } // namespace content 646 } // namespace content
621 647
622 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 648 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698