OLD | NEW |
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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // to see what it should do. | 164 // to see what it should do. |
165 virtual bool FocusLocationBarByDefault() = 0; | 165 virtual bool FocusLocationBarByDefault() = 0; |
166 | 166 |
167 // Focuses the location bar. | 167 // Focuses the location bar. |
168 virtual void SetFocusToLocationBar(bool select_all) = 0; | 168 virtual void SetFocusToLocationBar(bool select_all) = 0; |
169 | 169 |
170 // Returns true if views created for this delegate should be created in a | 170 // Returns true if views created for this delegate should be created in a |
171 // hidden state. | 171 // hidden state. |
172 virtual bool IsHidden() = 0; | 172 virtual bool IsHidden() = 0; |
173 | 173 |
| 174 // If the delegate is an inner WebContents, this method returns the |
| 175 // FrameTreeNode ID of the frame in the outer WebContents which hosts |
| 176 // the inner WebContents. Returns FrameTreeNode::kFrameTreeNodeInvalidID |
| 177 // if the delegate does not have an outer WebContents. |
| 178 virtual int GetOuterDelegateFrameTreeNodeID() = 0; |
| 179 |
174 protected: | 180 protected: |
175 virtual ~Delegate() {} | 181 virtual ~Delegate() {} |
176 }; | 182 }; |
177 | 183 |
178 // Used with FrameTree::ForEach to delete RenderFrameHosts pending shutdown | 184 // Used with FrameTree::ForEach to delete RenderFrameHosts pending shutdown |
179 // from a FrameTreeNode's RenderFrameHostManager. Used during destruction of | 185 // from a FrameTreeNode's RenderFrameHostManager. Used during destruction of |
180 // WebContentsImpl. | 186 // WebContentsImpl. |
181 static bool ClearRFHsPendingShutdown(FrameTreeNode* node); | 187 static bool ClearRFHsPendingShutdown(FrameTreeNode* node); |
182 | 188 |
183 // All three delegate pointers must be non-NULL and are not owned by this | 189 // All three delegate pointers must be non-NULL and are not owned by this |
(...skipping 25 matching lines...) Expand all Loading... |
209 return render_frame_host_.get(); | 215 return render_frame_host_.get(); |
210 } | 216 } |
211 | 217 |
212 // TODO(creis): Remove this when we no longer use RVH for navigation. | 218 // TODO(creis): Remove this when we no longer use RVH for navigation. |
213 RenderViewHostImpl* current_host() const; | 219 RenderViewHostImpl* current_host() const; |
214 | 220 |
215 // Returns the view associated with the current RenderViewHost, or NULL if | 221 // Returns the view associated with the current RenderViewHost, or NULL if |
216 // there is no current one. | 222 // there is no current one. |
217 RenderWidgetHostView* GetRenderWidgetHostView() const; | 223 RenderWidgetHostView* GetRenderWidgetHostView() const; |
218 | 224 |
| 225 // Returns whether this manager belongs to a FrameTreeNode that is a main |
| 226 // frame in an inner WebContents. |
| 227 // TODO(lazyboy): Make this work correctly for subframes inside inner |
| 228 // WebContents too. |
| 229 bool ForInnerDelegate(); |
| 230 |
| 231 // Returns the RenderWidgetHost of the outer WebContents (if any) that can be |
| 232 // used to fetch the last keyboard event. |
| 233 // TODO(lazyboy): This can be removed once input events are sent directly to |
| 234 // remote frames. |
| 235 RenderWidgetHostImpl* GetOuterRenderWidgetHostForKeyboardInput(); |
| 236 |
219 RenderFrameProxyHost* GetProxyToParent(); | 237 RenderFrameProxyHost* GetProxyToParent(); |
220 | 238 |
| 239 // Returns the proxy to inner WebContents in the outer WebContents's |
| 240 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer |
| 241 // relationship. |
| 242 RenderFrameProxyHost* GetProxyToOuterDelegate(); |
| 243 |
| 244 // Removes the FrameTreeNode in the outer WebContents that represents this |
| 245 // FrameTreeNode. |
| 246 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to |
| 247 // somehwere else. |
| 248 void RemoveOuterDelegateFrame(); |
| 249 |
221 // Returns the pending RenderFrameHost, or NULL if there is no pending one. | 250 // Returns the pending RenderFrameHost, or NULL if there is no pending one. |
222 RenderFrameHostImpl* pending_frame_host() const { | 251 RenderFrameHostImpl* pending_frame_host() const { |
223 return pending_render_frame_host_.get(); | 252 return pending_render_frame_host_.get(); |
224 } | 253 } |
225 | 254 |
226 // Returns the speculative RenderFrameHost, or null if there is no speculative | 255 // Returns the speculative RenderFrameHost, or null if there is no speculative |
227 // one. | 256 // one. |
228 RenderFrameHostImpl* speculative_frame_host_for_testing() const { | 257 RenderFrameHostImpl* speculative_frame_host_for_testing() const { |
229 return speculative_render_frame_host_.get(); | 258 return speculative_render_frame_host_.get(); |
230 } | 259 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 448 |
420 // Recursively creates swapped out RenderViews and RenderFrameProxies for | 449 // Recursively creates swapped out RenderViews and RenderFrameProxies for |
421 // this frame's FrameTree and for its opener chain in the given SiteInstance. | 450 // this frame's FrameTree and for its opener chain in the given SiteInstance. |
422 // This allows other tabs to send cross-process JavaScript calls to their | 451 // This allows other tabs to send cross-process JavaScript calls to their |
423 // opener(s) and to any other frames in the opener's FrameTree (e.g., | 452 // opener(s) and to any other frames in the opener's FrameTree (e.g., |
424 // supporting calls like window.opener.opener.frames[x][y]). Returns the | 453 // supporting calls like window.opener.opener.frames[x][y]). Returns the |
425 // route ID of this frame's RenderView for |instance|. | 454 // route ID of this frame's RenderView for |instance|. |
426 // TODO(alexmos): Switch this to return RenderFrame routing IDs. | 455 // TODO(alexmos): Switch this to return RenderFrame routing IDs. |
427 int CreateOpenerProxies(SiteInstance* instance); | 456 int CreateOpenerProxies(SiteInstance* instance); |
428 | 457 |
| 458 // Called on the RFHM of the inner WebContents to create a |
| 459 // RenderFrameProxyHost in its outer WebContents's SiteInstance, |
| 460 // |outer_contents_site_instance|. The frame in outer WebContents that is |
| 461 // hosting the inner WebContents is |render_frame_host|, and the frame will |
| 462 // be swapped out with the proxy. |
| 463 void CreateOuterDelegateProxy(SiteInstance* outer_contents_site_instance, |
| 464 RenderFrameHostImpl* render_frame_host); |
| 465 |
| 466 // Sets the child RenderWidgetHostView for this frame, which must be part of |
| 467 // an inner WebContents. |
| 468 void SetRWHViewForInnerContents(RenderWidgetHostView* child_rwhv); |
| 469 |
429 private: | 470 private: |
430 friend class FrameTreeVisualizer; | 471 friend class FrameTreeVisualizer; |
431 friend class NavigatorTestWithBrowserSideNavigation; | 472 friend class NavigatorTestWithBrowserSideNavigation; |
432 friend class RenderFrameHostManagerTest; | 473 friend class RenderFrameHostManagerTest; |
433 friend class TestWebContents; | 474 friend class TestWebContents; |
434 | 475 |
435 // Stores information regarding a SiteInstance targeted at a specific URL to | 476 // Stores information regarding a SiteInstance targeted at a specific URL to |
436 // allow for comparisons without having to actually create new instances. It | 477 // allow for comparisons without having to actually create new instances. It |
437 // can point to an existing one or store the details needed to create a new | 478 // can point to an existing one or store the details needed to create a new |
438 // one. | 479 // one. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 bool should_reuse_web_ui_; | 790 bool should_reuse_web_ui_; |
750 | 791 |
751 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 792 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
752 | 793 |
753 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 794 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
754 }; | 795 }; |
755 | 796 |
756 } // namespace content | 797 } // namespace content |
757 | 798 |
758 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 799 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |