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