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_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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
18 #include "content/browser/bad_message.h" | 18 #include "content/browser/bad_message.h" |
19 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
20 #include "content/browser/webui/web_ui_impl.h" | |
20 #include "content/common/accessibility_mode_enums.h" | 21 #include "content/common/accessibility_mode_enums.h" |
21 #include "content/common/ax_content_node_data.h" | 22 #include "content/common/ax_content_node_data.h" |
22 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
23 #include "content/common/frame_message_enums.h" | 24 #include "content/common/frame_message_enums.h" |
24 #include "content/common/frame_replication_state.h" | 25 #include "content/common/frame_replication_state.h" |
25 #include "content/common/image_downloader/image_downloader.mojom.h" | 26 #include "content/common/image_downloader/image_downloader.mojom.h" |
26 #include "content/common/mojo/service_registry_impl.h" | 27 #include "content/common/mojo/service_registry_impl.h" |
27 #include "content/common/navigation_params.h" | 28 #include "content/common/navigation_params.h" |
28 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
29 #include "content/public/common/javascript_message_type.h" | 30 #include "content/public/common/javascript_message_type.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 int new_routing_id, | 212 int new_routing_id, |
212 blink::WebTreeScopeType scope, | 213 blink::WebTreeScopeType scope, |
213 const std::string& frame_name, | 214 const std::string& frame_name, |
214 blink::WebSandboxFlags sandbox_flags, | 215 blink::WebSandboxFlags sandbox_flags, |
215 const blink::WebFrameOwnerProperties& frame_owner_properties); | 216 const blink::WebFrameOwnerProperties& frame_owner_properties); |
216 | 217 |
217 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 218 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
218 RenderFrameHostDelegate* delegate() { return delegate_; } | 219 RenderFrameHostDelegate* delegate() { return delegate_; } |
219 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 220 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
220 | 221 |
222 // Returns the associated WebUI or null if none applies. | |
223 WebUIImpl* web_ui() const { return web_ui_.get(); } | |
224 | |
225 // Returns the pending WebUI, or null if none applies. | |
226 WebUIImpl* pending_web_ui() const { | |
227 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | |
228 } | |
229 | |
221 // Returns this RenderFrameHost's loading state. This method is only used by | 230 // Returns this RenderFrameHost's loading state. This method is only used by |
222 // FrameTreeNode. The proper way to check whether a frame is loading is to | 231 // FrameTreeNode. The proper way to check whether a frame is loading is to |
223 // call FrameTreeNode::IsLoading. | 232 // call FrameTreeNode::IsLoading. |
224 bool is_loading() const { return is_loading_; } | 233 bool is_loading() const { return is_loading_; } |
225 | 234 |
226 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 235 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
227 // or else it returns nullptr. | 236 // or else it returns nullptr. |
228 // If the RenderFrameHost is the page's main frame, this returns instead a | 237 // If the RenderFrameHost is the page's main frame, this returns instead a |
229 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 238 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
230 RenderWidgetHostImpl* GetRenderWidgetHost(); | 239 RenderWidgetHostImpl* GetRenderWidgetHost(); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 | 480 |
472 // Tears down the browser-side state relating to the Mojo connection between | 481 // Tears down the browser-side state relating to the Mojo connection between |
473 // this instance and its associated render frame. | 482 // this instance and its associated render frame. |
474 void InvalidateMojoConnection(); | 483 void InvalidateMojoConnection(); |
475 | 484 |
476 // Returns whether the frame is focused. A frame is considered focused when it | 485 // Returns whether the frame is focused. A frame is considered focused when it |
477 // is the parent chain of the focused frame within the frame tree. In | 486 // is the parent chain of the focused frame within the frame tree. In |
478 // addition, its associated RenderWidgetHost has to be focused. | 487 // addition, its associated RenderWidgetHost has to be focused. |
479 bool IsFocused(); | 488 bool IsFocused(); |
480 | 489 |
490 // Updates the pending WebUI of this RenderFrameHost based on the provided | |
491 // |dest_url|, setting it to either none, a new instance or to reuse the | |
492 // currently active one. Returns true if the pending WebUI was updated. | |
493 // If this is a history navigation its NavigationEntry bindings should be | |
494 // provided through |entry_bindings| to allow verifying that they are not | |
495 // being set differently this time around. Otherwise |entry_bindings| should | |
496 // be set to NavigationEntryImpl::kInvalidBindings so that no checks are done. | |
497 bool UpdatePendingWebUI(const GURL& dest_url, int entry_bindings); | |
498 | |
499 // Updates the active WebUI with the pending one set by the last call to | |
500 // UpdatePendingWebUI and then clears any pending data. If UpdatePendingWebUI | |
501 // was not called the active WebUI will simply be cleared. | |
502 void CommitPendingWebUI(); | |
503 | |
504 // Destroys the pending WebUI and resets related data. | |
505 void ClearPendingWebUI(); | |
506 | |
507 // Destroys all WebUI instances and resets related data. | |
508 void ClearAllWebUIs(); | |
nasko
2015/11/18 23:48:03
nit: drop the "s" at the end of the method name.
carlosk
2015/11/19 16:49:14
Done.
Is there a rule-of-thumb here? It seemed to
| |
509 | |
481 // Returns the Mojo ImageDownloader service. | 510 // Returns the Mojo ImageDownloader service. |
482 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 511 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
483 | 512 |
484 protected: | 513 protected: |
485 friend class RenderFrameHostFactory; | 514 friend class RenderFrameHostFactory; |
486 | 515 |
487 // |flags| is a combination of CreateRenderFrameFlags. | 516 // |flags| is a combination of CreateRenderFrameFlags. |
488 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 517 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
489 // should be the abstraction needed here, but we need RenderViewHost to pass | 518 // should be the abstraction needed here, but we need RenderViewHost to pass |
490 // into WebContentsObserver::FrameDetached for now. | 519 // into WebContentsObserver::FrameDetached for now. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 // Holder of Mojo connection with ImageDownloader service in RenderFrame. | 847 // Holder of Mojo connection with ImageDownloader service in RenderFrame. |
819 image_downloader::ImageDownloaderPtr mojo_image_downloader_; | 848 image_downloader::ImageDownloaderPtr mojo_image_downloader_; |
820 | 849 |
821 // Tracks a navigation happening in this frame. Note that while there can be | 850 // Tracks a navigation happening in this frame. Note that while there can be |
822 // two navigations in the same FrameTreeNode, there can only be one | 851 // two navigations in the same FrameTreeNode, there can only be one |
823 // navigation per RenderFrameHost. | 852 // navigation per RenderFrameHost. |
824 // PlzNavigate: before the navigation is ready to be committed, the | 853 // PlzNavigate: before the navigation is ready to be committed, the |
825 // NavigationHandle for it is owned by the NavigationRequest. | 854 // NavigationHandle for it is owned by the NavigationRequest. |
826 scoped_ptr<NavigationHandleImpl> navigation_handle_; | 855 scoped_ptr<NavigationHandleImpl> navigation_handle_; |
827 | 856 |
857 // The associated WebUIImpl and its type. They will be set if the current | |
858 // document is from WebUI source. Otherwise they will be null and | |
859 // WebUI::kNoWebUI, respectively. | |
860 scoped_ptr<WebUIImpl> web_ui_; | |
861 WebUI::TypeID web_ui_type_; | |
862 | |
863 // The pending WebUIImpl and its type. These will only be set during a | |
864 // same-site navigation to a document requiring a new WebUI. | |
nasko
2015/11/18 23:48:03
Why do we need a pending WebUI for a same-site nav
carlosk
2015/11/19 16:49:14
This is the main motivation of this revert to havi
nasko
2015/11/19 19:45:24
Transition from having a WebUI to not having WebUI
carlosk
2015/11/20 12:21:10
It should indeed and that's what we expected when
| |
865 scoped_ptr<WebUIImpl> pending_web_ui_; | |
866 WebUI::TypeID pending_web_ui_type_; | |
867 | |
868 // If true the associated WebUI should be reused when CommitPendingWebUI is | |
869 // called (no pending instance should be set). | |
870 bool should_reuse_web_ui_; | |
871 | |
828 // NOTE: This must be the last member. | 872 // NOTE: This must be the last member. |
829 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 873 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
830 | 874 |
831 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 875 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
832 }; | 876 }; |
833 | 877 |
834 } // namespace content | 878 } // namespace content |
835 | 879 |
836 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 880 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |