OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
| 16 #include "content/browser/frame_host/render_frame_host_impl.h" |
16 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
17 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
18 #include "content/common/accessibility_node_data.h" | 19 #include "content/common/accessibility_node_data.h" |
19 #include "content/common/drag_event_source_info.h" | 20 #include "content/common/drag_event_source_info.h" |
20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/common/javascript_message_type.h" | 23 #include "content/public/common/javascript_message_type.h" |
23 #include "content/public/common/page_transition_types.h" | 24 #include "content/public/common/page_transition_types.h" |
24 #include "content/public/common/window_container_type.h" | 25 #include "content/public/common/window_container_type.h" |
25 #include "net/base/load_states.h" | 26 #include "net/base/load_states.h" |
(...skipping 27 matching lines...) Expand all Loading... |
53 | 54 |
54 namespace ui { | 55 namespace ui { |
55 struct SelectedFileInfo; | 56 struct SelectedFileInfo; |
56 } | 57 } |
57 | 58 |
58 namespace content { | 59 namespace content { |
59 | 60 |
60 class BrowserMediaPlayerManager; | 61 class BrowserMediaPlayerManager; |
61 class ChildProcessSecurityPolicyImpl; | 62 class ChildProcessSecurityPolicyImpl; |
62 class PageState; | 63 class PageState; |
| 64 class RenderFrameHostDelegate; |
| 65 class RenderFrameHostImpl; |
63 class RenderWidgetHostDelegate; | 66 class RenderWidgetHostDelegate; |
64 class SessionStorageNamespace; | 67 class SessionStorageNamespace; |
65 class SessionStorageNamespaceImpl; | 68 class SessionStorageNamespaceImpl; |
66 class TestRenderViewHost; | 69 class TestRenderViewHost; |
67 struct ContextMenuParams; | 70 struct ContextMenuParams; |
68 struct FileChooserParams; | 71 struct FileChooserParams; |
69 struct Referrer; | 72 struct Referrer; |
70 struct ShowDesktopNotificationHostMsgParams; | 73 struct ShowDesktopNotificationHostMsgParams; |
71 | 74 |
72 #if defined(COMPILER_MSVC) | 75 #if defined(COMPILER_MSVC) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // view is initially hidden or visible. | 112 // view is initially hidden or visible. |
110 // | 113 // |
111 // The |session_storage_namespace| parameter allows multiple render views and | 114 // The |session_storage_namespace| parameter allows multiple render views and |
112 // WebContentses to share the same session storage (part of the WebStorage | 115 // WebContentses to share the same session storage (part of the WebStorage |
113 // spec) space. This is useful when restoring contentses, but most callers | 116 // spec) space. This is useful when restoring contentses, but most callers |
114 // should pass in NULL which will cause a new SessionStorageNamespace to be | 117 // should pass in NULL which will cause a new SessionStorageNamespace to be |
115 // created. | 118 // created. |
116 RenderViewHostImpl( | 119 RenderViewHostImpl( |
117 SiteInstance* instance, | 120 SiteInstance* instance, |
118 RenderViewHostDelegate* delegate, | 121 RenderViewHostDelegate* delegate, |
| 122 RenderFrameHostDelegate* frame_delegate, |
119 RenderWidgetHostDelegate* widget_delegate, | 123 RenderWidgetHostDelegate* widget_delegate, |
120 int routing_id, | 124 int routing_id, |
121 int main_frame_routing_id, | 125 int main_frame_routing_id, |
122 bool swapped_out, | 126 bool swapped_out, |
123 bool hidden); | 127 bool hidden); |
124 virtual ~RenderViewHostImpl(); | 128 virtual ~RenderViewHostImpl(); |
125 | 129 |
126 // RenderViewHost implementation. | 130 // RenderViewHost implementation. |
127 virtual void AllowBindings(int binding_flags) OVERRIDE; | 131 virtual void AllowBindings(int binding_flags) OVERRIDE; |
128 virtual void ClearFocusedNode() OVERRIDE; | 132 virtual void ClearFocusedNode() OVERRIDE; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 void OnRunFileChooser(const FileChooserParams& params); | 610 void OnRunFileChooser(const FileChooserParams& params); |
607 void OnDidAccessInitialDocument(); | 611 void OnDidAccessInitialDocument(); |
608 void OnDomOperationResponse(const std::string& json_string, | 612 void OnDomOperationResponse(const std::string& json_string, |
609 int automation_id); | 613 int automation_id); |
610 void OnFocusedNodeTouched(bool editable); | 614 void OnFocusedNodeTouched(bool editable); |
611 | 615 |
612 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 616 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
613 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 617 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
614 #endif | 618 #endif |
615 | 619 |
| 620 // TODO(nasko): Remove this accessor once RenderFrameHost moves into the frame |
| 621 // tree. |
| 622 RenderFrameHostImpl* main_render_frame_host() const { |
| 623 return main_render_frame_host_.get(); |
| 624 } |
| 625 |
616 private: | 626 private: |
617 friend class TestRenderViewHost; | 627 friend class TestRenderViewHost; |
618 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost); | 628 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost); |
619 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane); | 629 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane); |
620 | 630 |
621 // Sets whether this RenderViewHost is swapped out in favor of another, | 631 // Sets whether this RenderViewHost is swapped out in favor of another, |
622 // and clears any waiting state that is no longer relevant. | 632 // and clears any waiting state that is no longer relevant. |
623 void SetSwappedOut(bool is_swapped_out); | 633 void SetSwappedOut(bool is_swapped_out); |
624 | 634 |
625 bool CanAccessFilesOfPageState(const PageState& state) const; | 635 bool CanAccessFilesOfPageState(const PageState& state) const; |
626 | 636 |
| 637 // All RenderViewHosts must have a RenderFrameHost for its main frame. |
| 638 // Currently the RenderFrameHost is created in lock step on construction |
| 639 // and a pointer to the main frame is given to the FrameTreeNode |
| 640 // when the RenderViewHost commits (see AttachToFrameTree()). |
| 641 // |
| 642 // TODO(ajwong): Make this reference non-owning. The root FrameTreeNode of |
| 643 // the FrameTree should be responsible for owning the main frame's |
| 644 // RenderFrameHost. |
| 645 scoped_ptr<RenderFrameHostImpl> main_render_frame_host_; |
| 646 |
627 // Our delegate, which wants to know about changes in the RenderView. | 647 // Our delegate, which wants to know about changes in the RenderView. |
628 RenderViewHostDelegate* delegate_; | 648 RenderViewHostDelegate* delegate_; |
629 | 649 |
630 // The SiteInstance associated with this RenderViewHost. All pages drawn | 650 // The SiteInstance associated with this RenderViewHost. All pages drawn |
631 // in this RenderViewHost are part of this SiteInstance. Should not change | 651 // in this RenderViewHost are part of this SiteInstance. Should not change |
632 // over time. | 652 // over time. |
633 scoped_refptr<SiteInstanceImpl> instance_; | 653 scoped_refptr<SiteInstanceImpl> instance_; |
634 | 654 |
635 // true if we are currently waiting for a response for drag context | 655 // true if we are currently waiting for a response for drag context |
636 // information. | 656 // information. |
(...skipping 25 matching lines...) Expand all Loading... |
662 // being rendered by another process. | 682 // being rendered by another process. |
663 bool is_swapped_out_; | 683 bool is_swapped_out_; |
664 | 684 |
665 // Whether this RenderView is responsible for displaying a subframe in a | 685 // Whether this RenderView is responsible for displaying a subframe in a |
666 // different process from its parent page. | 686 // different process from its parent page. |
667 bool is_subframe_; | 687 bool is_subframe_; |
668 | 688 |
669 // The frame id of the main (top level) frame. This value is set on the | 689 // The frame id of the main (top level) frame. This value is set on the |
670 // initial navigation of a RenderView and reset when the RenderView's | 690 // initial navigation of a RenderView and reset when the RenderView's |
671 // process is terminated (in RenderProcessGone). | 691 // process is terminated (in RenderProcessGone). |
672 // TODO(creis): Remove this when we switch to routing IDs for frames. | |
673 int64 main_frame_id_; | 692 int64 main_frame_id_; |
674 | 693 |
675 // Routing ID for the main frame's RenderFrameHost. | |
676 int main_frame_routing_id_; | |
677 | |
678 // If we were asked to RunModal, then this will hold the reply_msg that we | 694 // If we were asked to RunModal, then this will hold the reply_msg that we |
679 // must return to the renderer to unblock it. | 695 // must return to the renderer to unblock it. |
680 IPC::Message* run_modal_reply_msg_; | 696 IPC::Message* run_modal_reply_msg_; |
681 // This will hold the routing id of the RenderView that opened us. | 697 // This will hold the routing id of the RenderView that opened us. |
682 int run_modal_opener_id_; | 698 int run_modal_opener_id_; |
683 | 699 |
684 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 700 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
685 // ensures we don't spam the renderer with multiple beforeunload requests. | 701 // ensures we don't spam the renderer with multiple beforeunload requests. |
686 // When either this value or is_waiting_for_unload_ack_ is true, the value of | 702 // When either this value or is_waiting_for_unload_ack_ is true, the value of |
687 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 703 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); | 747 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); |
732 }; | 748 }; |
733 | 749 |
734 #if defined(COMPILER_MSVC) | 750 #if defined(COMPILER_MSVC) |
735 #pragma warning(pop) | 751 #pragma warning(pop) |
736 #endif | 752 #endif |
737 | 753 |
738 } // namespace content | 754 } // namespace content |
739 | 755 |
740 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 756 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
OLD | NEW |