| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <map> | 11 #include <map> |
| 9 #include <string> | 12 #include <string> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/callback.h" | 15 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 14 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 16 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 17 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "build/build_config.h" |
| 18 #include "content/browser/accessibility/browser_accessibility_manager.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 19 #include "content/browser/bad_message.h" | 24 #include "content/browser/bad_message.h" |
| 20 #include "content/browser/site_instance_impl.h" | 25 #include "content/browser/site_instance_impl.h" |
| 21 #include "content/browser/webui/web_ui_impl.h" | 26 #include "content/browser/webui/web_ui_impl.h" |
| 22 #include "content/common/accessibility_mode_enums.h" | 27 #include "content/common/accessibility_mode_enums.h" |
| 23 #include "content/common/ax_content_node_data.h" | 28 #include "content/common/ax_content_node_data.h" |
| 24 #include "content/common/content_export.h" | 29 #include "content/common/content_export.h" |
| 25 #include "content/common/frame_message_enums.h" | 30 #include "content/common/frame_message_enums.h" |
| 26 #include "content/common/frame_replication_state.h" | 31 #include "content/common/frame_replication_state.h" |
| 27 #include "content/common/image_downloader/image_downloader.mojom.h" | 32 #include "content/common/image_downloader/image_downloader.mojom.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // |flags| is a combination of CreateRenderFrameFlags. | 527 // |flags| is a combination of CreateRenderFrameFlags. |
| 523 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 528 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 524 // should be the abstraction needed here, but we need RenderViewHost to pass | 529 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 525 // into WebContentsObserver::FrameDetached for now. | 530 // into WebContentsObserver::FrameDetached for now. |
| 526 RenderFrameHostImpl(SiteInstance* site_instance, | 531 RenderFrameHostImpl(SiteInstance* site_instance, |
| 527 RenderViewHostImpl* render_view_host, | 532 RenderViewHostImpl* render_view_host, |
| 528 RenderFrameHostDelegate* delegate, | 533 RenderFrameHostDelegate* delegate, |
| 529 RenderWidgetHostDelegate* rwh_delegate, | 534 RenderWidgetHostDelegate* rwh_delegate, |
| 530 FrameTree* frame_tree, | 535 FrameTree* frame_tree, |
| 531 FrameTreeNode* frame_tree_node, | 536 FrameTreeNode* frame_tree_node, |
| 532 int32 routing_id, | 537 int32_t routing_id, |
| 533 int32 widget_routing_id, | 538 int32_t widget_routing_id, |
| 534 int flags); | 539 int flags); |
| 535 | 540 |
| 536 private: | 541 private: |
| 537 friend class TestRenderFrameHost; | 542 friend class TestRenderFrameHost; |
| 538 friend class TestRenderViewHost; | 543 friend class TestRenderViewHost; |
| 539 | 544 |
| 540 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); | 545 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); |
| 541 | 546 |
| 542 // IPC Message handlers. | 547 // IPC Message handlers. |
| 543 void OnAddMessageToConsole(int32 level, | 548 void OnAddMessageToConsole(int32_t level, |
| 544 const base::string16& message, | 549 const base::string16& message, |
| 545 int32 line_no, | 550 int32_t line_no, |
| 546 const base::string16& source_id); | 551 const base::string16& source_id); |
| 547 void OnDetach(); | 552 void OnDetach(); |
| 548 void OnFrameFocused(); | 553 void OnFrameFocused(); |
| 549 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); | 554 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); |
| 550 void OnDocumentOnLoadCompleted( | 555 void OnDocumentOnLoadCompleted( |
| 551 FrameMsg_UILoadMetricsReportType::Value report_type, | 556 FrameMsg_UILoadMetricsReportType::Value report_type, |
| 552 base::TimeTicks ui_timestamp); | 557 base::TimeTicks ui_timestamp); |
| 553 void OnDidStartProvisionalLoad( | 558 void OnDidStartProvisionalLoad( |
| 554 const GURL& url, | 559 const GURL& url, |
| 555 const base::TimeTicks& navigation_start); | 560 const base::TimeTicks& navigation_start); |
| 556 void OnDidFailProvisionalLoadWithError( | 561 void OnDidFailProvisionalLoadWithError( |
| 557 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); | 562 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params); |
| 558 void OnDidFailLoadWithError( | 563 void OnDidFailLoadWithError( |
| 559 const GURL& url, | 564 const GURL& url, |
| 560 int error_code, | 565 int error_code, |
| 561 const base::string16& error_description, | 566 const base::string16& error_description, |
| 562 bool was_ignored_by_handler); | 567 bool was_ignored_by_handler); |
| 563 void OnDidCommitProvisionalLoad(const IPC::Message& msg); | 568 void OnDidCommitProvisionalLoad(const IPC::Message& msg); |
| 564 void OnDidDropNavigation(); | 569 void OnDidDropNavigation(); |
| 565 void OnUpdateState(const PageState& state); | 570 void OnUpdateState(const PageState& state); |
| 566 void OnBeforeUnloadACK( | 571 void OnBeforeUnloadACK( |
| 567 bool proceed, | 572 bool proceed, |
| 568 const base::TimeTicks& renderer_before_unload_start_time, | 573 const base::TimeTicks& renderer_before_unload_start_time, |
| 569 const base::TimeTicks& renderer_before_unload_end_time); | 574 const base::TimeTicks& renderer_before_unload_end_time); |
| 570 void OnSwapOutACK(); | 575 void OnSwapOutACK(); |
| 571 void OnRenderProcessGone(int status, int error_code); | 576 void OnRenderProcessGone(int status, int error_code); |
| 572 void OnContextMenu(const ContextMenuParams& params); | 577 void OnContextMenu(const ContextMenuParams& params); |
| 573 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); | 578 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); |
| 574 void OnVisualStateResponse(uint64 id); | 579 void OnVisualStateResponse(uint64_t id); |
| 575 void OnRunJavaScriptMessage(const base::string16& message, | 580 void OnRunJavaScriptMessage(const base::string16& message, |
| 576 const base::string16& default_prompt, | 581 const base::string16& default_prompt, |
| 577 const GURL& frame_url, | 582 const GURL& frame_url, |
| 578 JavaScriptMessageType type, | 583 JavaScriptMessageType type, |
| 579 IPC::Message* reply_msg); | 584 IPC::Message* reply_msg); |
| 580 void OnRunBeforeUnloadConfirm(const GURL& frame_url, | 585 void OnRunBeforeUnloadConfirm(const GURL& frame_url, |
| 581 const base::string16& message, | 586 const base::string16& message, |
| 582 bool is_reload, | 587 bool is_reload, |
| 583 IPC::Message* reply_msg); | 588 IPC::Message* reply_msg); |
| 584 void OnTextSurroundingSelectionResponse(const base::string16& content, | 589 void OnTextSurroundingSelectionResponse(const base::string16& content, |
| 585 size_t start_offset, | 590 size_t start_offset, |
| 586 size_t end_offset); | 591 size_t end_offset); |
| 587 void OnDidAccessInitialDocument(); | 592 void OnDidAccessInitialDocument(); |
| 588 void OnDidChangeOpener(int32 opener_routing_id); | 593 void OnDidChangeOpener(int32_t opener_routing_id); |
| 589 void OnDidChangeName(const std::string& name); | 594 void OnDidChangeName(const std::string& name); |
| 590 void OnEnforceStrictMixedContentChecking(); | 595 void OnEnforceStrictMixedContentChecking(); |
| 591 void OnDidAssignPageId(int32 page_id); | 596 void OnDidAssignPageId(int32_t page_id); |
| 592 void OnDidChangeSandboxFlags(int32 frame_routing_id, | 597 void OnDidChangeSandboxFlags(int32_t frame_routing_id, |
| 593 blink::WebSandboxFlags flags); | 598 blink::WebSandboxFlags flags); |
| 594 void OnDidChangeFrameOwnerProperties( | 599 void OnDidChangeFrameOwnerProperties( |
| 595 int32 frame_routing_id, | 600 int32_t frame_routing_id, |
| 596 const blink::WebFrameOwnerProperties& frame_owner_properties); | 601 const blink::WebFrameOwnerProperties& frame_owner_properties); |
| 597 void OnUpdateTitle(const base::string16& title, | 602 void OnUpdateTitle(const base::string16& title, |
| 598 blink::WebTextDirection title_direction); | 603 blink::WebTextDirection title_direction); |
| 599 void OnUpdateEncoding(const std::string& encoding); | 604 void OnUpdateEncoding(const std::string& encoding); |
| 600 void OnBeginNavigation(const CommonNavigationParams& common_params, | 605 void OnBeginNavigation(const CommonNavigationParams& common_params, |
| 601 const BeginNavigationParams& begin_params, | 606 const BeginNavigationParams& begin_params, |
| 602 scoped_refptr<ResourceRequestBody> body); | 607 scoped_refptr<ResourceRequestBody> body); |
| 603 void OnDispatchLoad(); | 608 void OnDispatchLoad(); |
| 604 void OnAccessibilityEvents( | 609 void OnAccessibilityEvents( |
| 605 const std::vector<AccessibilityHostMsg_EventParams>& params, | 610 const std::vector<AccessibilityHostMsg_EventParams>& params, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 // directly. | 682 // directly. |
| 678 void SendNavigateMessage( | 683 void SendNavigateMessage( |
| 679 const content::CommonNavigationParams& common_params, | 684 const content::CommonNavigationParams& common_params, |
| 680 const content::StartNavigationParams& start_params, | 685 const content::StartNavigationParams& start_params, |
| 681 const content::RequestNavigationParams& request_params); | 686 const content::RequestNavigationParams& request_params); |
| 682 | 687 |
| 683 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | 688 // Returns the child FrameTreeNode if |child_frame_routing_id| is an |
| 684 // immediate child of this FrameTreeNode. |child_frame_routing_id| is | 689 // immediate child of this FrameTreeNode. |child_frame_routing_id| is |
| 685 // considered untrusted, so the renderer process is killed if it refers to a | 690 // considered untrusted, so the renderer process is killed if it refers to a |
| 686 // FrameTreeNode that is not a child of this node. | 691 // FrameTreeNode that is not a child of this node. |
| 687 FrameTreeNode* FindAndVerifyChild( | 692 FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, |
| 688 int32 child_frame_routing_id, bad_message::BadMessageReason reason); | 693 bad_message::BadMessageReason reason); |
| 689 | 694 |
| 690 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 695 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
| 691 // refcount that calls Shutdown when it reaches zero. This allows each | 696 // refcount that calls Shutdown when it reaches zero. This allows each |
| 692 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 697 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
| 693 // we have a RenderViewHost for each RenderFrameHost. | 698 // we have a RenderViewHost for each RenderFrameHost. |
| 694 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 699 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
| 695 // some form of page context. | 700 // some form of page context. |
| 696 RenderViewHostImpl* render_view_host_; | 701 RenderViewHostImpl* render_view_host_; |
| 697 | 702 |
| 698 RenderFrameHostDelegate* delegate_; | 703 RenderFrameHostDelegate* delegate_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 // Allows this RenderFrameHost to add and remove nodes in response to | 735 // Allows this RenderFrameHost to add and remove nodes in response to |
| 731 // messages from the renderer requesting DOM manipulation. | 736 // messages from the renderer requesting DOM manipulation. |
| 732 FrameTree* frame_tree_; | 737 FrameTree* frame_tree_; |
| 733 | 738 |
| 734 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 739 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
| 735 FrameTreeNode* frame_tree_node_; | 740 FrameTreeNode* frame_tree_node_; |
| 736 | 741 |
| 737 // The mapping of pending JavaScript calls created by | 742 // The mapping of pending JavaScript calls created by |
| 738 // ExecuteJavaScript and their corresponding callbacks. | 743 // ExecuteJavaScript and their corresponding callbacks. |
| 739 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 744 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
| 740 std::map<uint64, VisualStateCallback> visual_state_callbacks_; | 745 std::map<uint64_t, VisualStateCallback> visual_state_callbacks_; |
| 741 | 746 |
| 742 // RenderFrameHosts that need management of the rendering and input events | 747 // RenderFrameHosts that need management of the rendering and input events |
| 743 // for their frame subtrees require RenderWidgetHosts. This typically | 748 // for their frame subtrees require RenderWidgetHosts. This typically |
| 744 // means frames that are rendered in different processes from their parent | 749 // means frames that are rendered in different processes from their parent |
| 745 // frames. | 750 // frames. |
| 746 // TODO(kenrb): Later this will also be used on the top-level frame, when | 751 // TODO(kenrb): Later this will also be used on the top-level frame, when |
| 747 // RenderFrameHost owns its RenderViewHost. | 752 // RenderFrameHost owns its RenderViewHost. |
| 748 RenderWidgetHostImpl* render_widget_host_; | 753 RenderWidgetHostImpl* render_widget_host_; |
| 749 | 754 |
| 750 int routing_id_; | 755 int routing_id_; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 | 885 |
| 881 // NOTE: This must be the last member. | 886 // NOTE: This must be the last member. |
| 882 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 887 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 883 | 888 |
| 884 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 889 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 885 }; | 890 }; |
| 886 | 891 |
| 887 } // namespace content | 892 } // namespace content |
| 888 | 893 |
| 889 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 894 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |