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

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: Moved InitForFrame call, addressed other comments Created 5 years, 11 months 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 in a different
86 // process from its parent frame.
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // cross-process subframe navigations in --site-per-process. 173 // cross-process subframe navigations in --site-per-process.
168 bool CreateRenderFrame(int parent_routing_id, int proxy_routing_id); 174 bool CreateRenderFrame(int parent_routing_id, int proxy_routing_id);
169 175
170 // Returns whether the RenderFrame in the renderer process has been created 176 // Returns whether the RenderFrame in the renderer process has been created
171 // and still has a connection. This is valid for all frames. 177 // and still has a connection. This is valid for all frames.
172 bool IsRenderFrameLive(); 178 bool IsRenderFrameLive();
173 179
174 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 180 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
175 // the renderer process. This is currently only used for subframes. 181 // the renderer process. This is currently only used for subframes.
176 // TODO(creis): Use this for main frames as well when RVH goes away. 182 // TODO(creis): Use this for main frames as well when RVH goes away.
177 void set_render_frame_created(bool created) { 183 void SetRenderFrameCreated(bool created);
178 render_frame_created_ = created;
179 }
180 184
181 // Called for renderer-created windows to resume requests from this frame, 185 // Called for renderer-created windows to resume requests from this frame,
182 // after they are blocked in RenderWidgetHelper::CreateNewWindow. 186 // after they are blocked in RenderWidgetHelper::CreateNewWindow.
183 void Init(); 187 void Init();
184 188
185 int routing_id() const { return routing_id_; } 189 int routing_id() const { return routing_id_; }
186 void OnCreateChildFrame(int new_routing_id, 190 void OnCreateChildFrame(int new_routing_id,
187 const std::string& frame_name); 191 const std::string& frame_name);
188 192
189 RenderViewHostImpl* render_view_host() { return render_view_host_; } 193 RenderViewHostImpl* render_view_host() { return render_view_host_; }
190 RenderFrameHostDelegate* delegate() { return delegate_; } 194 RenderFrameHostDelegate* delegate() { return delegate_; }
191 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 195 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
192 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in 196
193 // the future, so update this accessor to return the right pointer. 197 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
198 // or else it returns nullptr.
199 // If the RenderFrameHost is the page's main frame, this returns instead a
200 // pointer to the RenderViewHost (which inherits RenderWidgetHost).
194 RenderWidgetHostImpl* GetRenderWidgetHost(); 201 RenderWidgetHostImpl* GetRenderWidgetHost();
195 202
203 // This returns the RenderWidgetHostView that can be used to control
204 // focus and visibility for this frame.
205 RenderWidgetHostView* GetView();
206
196 // This function is called when this is a swapped out RenderFrameHost that 207 // This function is called when this is a swapped out RenderFrameHost that
197 // lives in the same process as the parent frame. The 208 // lives in the same process as the parent frame. The
198 // |cross_process_frame_connector| allows the non-swapped-out 209 // |cross_process_frame_connector| allows the non-swapped-out
199 // RenderFrameHost for a frame to communicate with the parent process 210 // RenderFrameHost for a frame to communicate with the parent process
200 // so that it may composite drawing data. 211 // so that it may composite drawing data.
201 // 212 //
202 // Ownership is not transfered. 213 // Ownership is not transfered.
203 void set_cross_process_frame_connector( 214 void set_cross_process_frame_connector(
204 CrossProcessFrameConnector* cross_process_frame_connector) { 215 CrossProcessFrameConnector* cross_process_frame_connector) {
205 cross_process_frame_connector_ = cross_process_frame_connector; 216 cross_process_frame_connector_ = cross_process_frame_connector;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 401
391 protected: 402 protected:
392 friend class RenderFrameHostFactory; 403 friend class RenderFrameHostFactory;
393 404
394 // |flags| is a combination of CreateRenderFrameFlags. 405 // |flags| is a combination of CreateRenderFrameFlags.
395 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 406 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
396 // 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
397 // into WebContentsObserver::FrameDetached for now. 408 // into WebContentsObserver::FrameDetached for now.
398 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 409 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
399 RenderFrameHostDelegate* delegate, 410 RenderFrameHostDelegate* delegate,
411 RenderWidgetHostDelegate* rwh_delegate,
400 FrameTree* frame_tree, 412 FrameTree* frame_tree,
401 FrameTreeNode* frame_tree_node, 413 FrameTreeNode* frame_tree_node,
402 int routing_id, 414 int routing_id,
403 int flags); 415 int flags);
404 416
405 private: 417 private:
406 friend class TestRenderFrameHost; 418 friend class TestRenderFrameHost;
407 friend class TestRenderViewHost; 419 friend class TestRenderViewHost;
408 420
409 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
529 // messages from the renderer requesting DOM manipulation. 541 // messages from the renderer requesting DOM manipulation.
530 FrameTree* frame_tree_; 542 FrameTree* frame_tree_;
531 543
532 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. 544 // The FrameTreeNode which this RenderFrameHostImpl is hosted in.
533 FrameTreeNode* frame_tree_node_; 545 FrameTreeNode* frame_tree_node_;
534 546
535 // The mapping of pending JavaScript calls created by 547 // The mapping of pending JavaScript calls created by
536 // ExecuteJavaScript and their corresponding callbacks. 548 // ExecuteJavaScript and their corresponding callbacks.
537 std::map<int, JavaScriptResultCallback> javascript_callbacks_; 549 std::map<int, JavaScriptResultCallback> javascript_callbacks_;
538 550
551 // RenderFrameHosts that need management of the rendering and input events
552 // for their frame subtrees require RenderWidgetHosts. This typically
553 // means frames that are rendered in different processes from their parent
554 // frames.
555 // TODO(kenrb): Later this will also be used on the top-level frame, when
556 // RenderFrameHost owns its RenderViewHost.
557 scoped_ptr<RenderWidgetHostImpl> render_widget_host_;
558
539 int routing_id_; 559 int routing_id_;
540 560
541 // The current state of this RenderFrameHost. 561 // The current state of this RenderFrameHost.
542 RenderFrameHostImplState rfh_state_; 562 RenderFrameHostImplState rfh_state_;
543 563
544 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 564 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
545 // the renderer process. Currently only used for subframes. 565 // the renderer process. Currently only used for subframes.
546 // TODO(creis): Use this for main frames as well when RVH goes away. 566 // TODO(creis): Use this for main frames as well when RVH goes away.
547 bool render_frame_created_; 567 bool render_frame_created_;
548 568
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 637
618 // NOTE: This must be the last member. 638 // NOTE: This must be the last member.
619 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 639 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
620 640
621 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 641 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
622 }; 642 };
623 643
624 } // namespace content 644 } // namespace content
625 645
626 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 646 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698