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 // Returns true if we are currently in a mode where the swapped out state | 189 // Returns true if we are currently in a mode where the swapped out state |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return render_frame_host_.get(); | 227 return render_frame_host_.get(); |
222 } | 228 } |
223 | 229 |
224 // TODO(creis): Remove this when we no longer use RVH for navigation. | 230 // TODO(creis): Remove this when we no longer use RVH for navigation. |
225 RenderViewHostImpl* current_host() const; | 231 RenderViewHostImpl* current_host() const; |
226 | 232 |
227 // Returns the view associated with the current RenderViewHost, or NULL if | 233 // Returns the view associated with the current RenderViewHost, or NULL if |
228 // there is no current one. | 234 // there is no current one. |
229 RenderWidgetHostView* GetRenderWidgetHostView() const; | 235 RenderWidgetHostView* GetRenderWidgetHostView() const; |
230 | 236 |
| 237 // Returns whether this manager belongs to a FrameTreeNode that is a main |
| 238 // frame in an inner WebContents. |
| 239 // TODO(lazyboy): Make this work correctly for subframes inside inner |
| 240 // WebContents too. |
| 241 bool ForInnerDelegate(); |
| 242 |
| 243 // Returns the RenderWidgetHost of the outer WebContents (if any) that can be |
| 244 // used to fetch the last keyboard event. |
| 245 // TODO(lazyboy): This can be removed once input events are sent directly to |
| 246 // remote frames. |
| 247 RenderWidgetHostImpl* GetOuterRenderWidgetHostForKeyboardInput(); |
| 248 |
231 RenderFrameProxyHost* GetProxyToParent(); | 249 RenderFrameProxyHost* GetProxyToParent(); |
232 | 250 |
| 251 // Returns the proxy to inner WebContents in the outer WebContents's |
| 252 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer |
| 253 // relationship. |
| 254 RenderFrameProxyHost* GetProxyToOuterDelegate(); |
| 255 |
| 256 // Removes the FrameTreeNode in the outer WebContents that represents this |
| 257 // FrameTreeNode. |
| 258 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to |
| 259 // somehwere else. |
| 260 void RemoveOuterDelegateFrame(); |
| 261 |
233 // Returns the pending RenderFrameHost, or NULL if there is no pending one. | 262 // Returns the pending RenderFrameHost, or NULL if there is no pending one. |
234 RenderFrameHostImpl* pending_frame_host() const { | 263 RenderFrameHostImpl* pending_frame_host() const { |
235 return pending_render_frame_host_.get(); | 264 return pending_render_frame_host_.get(); |
236 } | 265 } |
237 | 266 |
238 // Returns the speculative RenderFrameHost, or null if there is no speculative | 267 // Returns the speculative RenderFrameHost, or null if there is no speculative |
239 // one. | 268 // one. |
240 RenderFrameHostImpl* speculative_frame_host_for_testing() const { | 269 RenderFrameHostImpl* speculative_frame_host_for_testing() const { |
241 return speculative_render_frame_host_.get(); | 270 return speculative_render_frame_host_.get(); |
242 } | 271 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 460 |
432 // Recursively creates swapped out RenderViews and RenderFrameProxies for | 461 // Recursively creates swapped out RenderViews and RenderFrameProxies for |
433 // this frame's FrameTree and for its opener chain in the given SiteInstance. | 462 // this frame's FrameTree and for its opener chain in the given SiteInstance. |
434 // This allows other tabs to send cross-process JavaScript calls to their | 463 // This allows other tabs to send cross-process JavaScript calls to their |
435 // opener(s) and to any other frames in the opener's FrameTree (e.g., | 464 // opener(s) and to any other frames in the opener's FrameTree (e.g., |
436 // supporting calls like window.opener.opener.frames[x][y]). Returns the | 465 // supporting calls like window.opener.opener.frames[x][y]). Returns the |
437 // route ID of this frame's RenderView for |instance|. | 466 // route ID of this frame's RenderView for |instance|. |
438 // TODO(alexmos): Switch this to return RenderFrame routing IDs. | 467 // TODO(alexmos): Switch this to return RenderFrame routing IDs. |
439 int CreateOpenerProxies(SiteInstance* instance); | 468 int CreateOpenerProxies(SiteInstance* instance); |
440 | 469 |
| 470 // Called on the RFHM of the inner WebContents to create a |
| 471 // RenderFrameProxyHost in its outer WebContents's SiteInstance, |
| 472 // |outer_contents_site_instance|. The frame in outer WebContents that is |
| 473 // hosting the inner WebContents is |render_frame_host|, and the frame will |
| 474 // be swapped out with the proxy. |
| 475 void CreateOuterDelegateProxy(SiteInstance* outer_contents_site_instance, |
| 476 RenderFrameHostImpl* render_frame_host); |
| 477 |
| 478 // Sets the child RenderWidgetHostView for this frame, which must be part of |
| 479 // an inner WebContents. |
| 480 void SetRWHViewForInnerContents(RenderWidgetHostView* child_rwhv); |
| 481 |
441 private: | 482 private: |
442 friend class FrameTreeVisualizer; | 483 friend class FrameTreeVisualizer; |
443 friend class NavigatorTestWithBrowserSideNavigation; | 484 friend class NavigatorTestWithBrowserSideNavigation; |
444 friend class RenderFrameHostManagerTest; | 485 friend class RenderFrameHostManagerTest; |
445 friend class TestWebContents; | 486 friend class TestWebContents; |
446 | 487 |
447 // Stores information regarding a SiteInstance targeted at a specific URL to | 488 // Stores information regarding a SiteInstance targeted at a specific URL to |
448 // allow for comparisons without having to actually create new instances. It | 489 // allow for comparisons without having to actually create new instances. It |
449 // can point to an existing one or store the details needed to create a new | 490 // can point to an existing one or store the details needed to create a new |
450 // one. | 491 // one. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 bool should_reuse_web_ui_; | 802 bool should_reuse_web_ui_; |
762 | 803 |
763 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 804 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
764 | 805 |
765 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 806 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
766 }; | 807 }; |
767 | 808 |
768 } // namespace content | 809 } // namespace content |
769 | 810 |
770 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 811 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |