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> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 float y) OVERRIDE; | 220 float y) OVERRIDE; |
221 virtual void RequestFindMatchRects(int current_version) OVERRIDE; | 221 virtual void RequestFindMatchRects(int current_version) OVERRIDE; |
222 virtual void DisableFullscreenEncryptedMediaPlayback() OVERRIDE; | 222 virtual void DisableFullscreenEncryptedMediaPlayback() OVERRIDE; |
223 #endif | 223 #endif |
224 | 224 |
225 void set_delegate(RenderViewHostDelegate* d) { | 225 void set_delegate(RenderViewHostDelegate* d) { |
226 CHECK(d); // http://crbug.com/82827 | 226 CHECK(d); // http://crbug.com/82827 |
227 delegate_ = d; | 227 delegate_ = d; |
228 } | 228 } |
229 | 229 |
| 230 // Map renderer-specific frame IDs to browser-global FrameTreeNode IDs. |
| 231 // TODO(creis): Call Unregister. |
| 232 void RegisterFrameID(int64 frame_id, int64 frame_tree_node_id); |
| 233 void UnregisterFrameID(int64 frame_id); |
| 234 bool HasFrameID(int64 frame_id) const; |
| 235 int64 GetFrameTreeNodeID(int64 frame_id); |
| 236 int64 GetFrameIDForTesting(int64 frame_tree_node_id) const; |
| 237 |
230 // Set up the RenderView child process. Virtual because it is overridden by | 238 // Set up the RenderView child process. Virtual because it is overridden by |
231 // TestRenderViewHost. If the |frame_name| parameter is non-empty, it is used | 239 // TestRenderViewHost. If the |frame_name| parameter is non-empty, it is used |
232 // as the name of the new top-level frame. | 240 // as the name of the new top-level frame. |
233 // The |opener_route_id| parameter indicates which RenderView created this | 241 // The |opener_route_id| parameter indicates which RenderView created this |
234 // (MSG_ROUTING_NONE if none). If |max_page_id| is larger than -1, the | 242 // (MSG_ROUTING_NONE if none). If |max_page_id| is larger than -1, the |
235 // RenderView is told to start issuing page IDs at |max_page_id| + 1. | 243 // RenderView is told to start issuing page IDs at |max_page_id| + 1. |
236 virtual bool CreateRenderView(const base::string16& frame_name, | 244 virtual bool CreateRenderView(const base::string16& frame_name, |
237 int opener_route_id, | 245 int opener_route_id, |
238 int32 max_page_id); | 246 int32 max_page_id); |
239 | 247 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 430 |
423 // User rotated the screen. Calls the "onorientationchange" Javascript hook. | 431 // User rotated the screen. Calls the "onorientationchange" Javascript hook. |
424 void SendOrientationChangeEvent(int orientation); | 432 void SendOrientationChangeEvent(int orientation); |
425 | 433 |
426 // Sets a bit indicating whether the RenderView is responsible for displaying | 434 // Sets a bit indicating whether the RenderView is responsible for displaying |
427 // a subframe in a different process from its parent page. | 435 // a subframe in a different process from its parent page. |
428 void set_is_subframe(bool is_subframe) { | 436 void set_is_subframe(bool is_subframe) { |
429 is_subframe_ = is_subframe; | 437 is_subframe_ = is_subframe; |
430 } | 438 } |
431 | 439 |
432 // TODO(creis): Remove this when we replace frame IDs with RenderFrameHost | |
433 // routing IDs. | |
434 int64 main_frame_id() const { | |
435 return main_frame_id_; | |
436 } | |
437 | |
438 // Set the opener to null in the renderer process. | 440 // Set the opener to null in the renderer process. |
439 void DisownOpener(); | 441 void DisownOpener(); |
440 | 442 |
441 // Turn on accessibility testing. The given callback will be run | 443 // Turn on accessibility testing. The given callback will be run |
442 // every time an accessibility notification is received from the | 444 // every time an accessibility notification is received from the |
443 // renderer process, and the accessibility tree it sent can be | 445 // renderer process, and the accessibility tree it sent can be |
444 // retrieved using accessibility_tree_for_testing(). | 446 // retrieved using accessibility_tree_for_testing(). |
445 void SetAccessibilityCallbackForTesting( | 447 void SetAccessibilityCallbackForTesting( |
446 const base::Callback<void(blink::WebAXEvent)>& callback); | 448 const base::Callback<void(blink::WebAXEvent)>& callback); |
447 | 449 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 static void FilterURL(ChildProcessSecurityPolicyImpl* policy, | 482 static void FilterURL(ChildProcessSecurityPolicyImpl* policy, |
481 const RenderProcessHost* process, | 483 const RenderProcessHost* process, |
482 bool empty_allowed, | 484 bool empty_allowed, |
483 GURL* url); | 485 GURL* url); |
484 | 486 |
485 // Update the FrameTree to use this RenderViewHost's main frame | 487 // Update the FrameTree to use this RenderViewHost's main frame |
486 // RenderFrameHost. Called when the RenderViewHost is committed. | 488 // RenderFrameHost. Called when the RenderViewHost is committed. |
487 // | 489 // |
488 // TODO(ajwong): Remove once RenderViewHost no longer owns the main frame | 490 // TODO(ajwong): Remove once RenderViewHost no longer owns the main frame |
489 // RenderFrameHost. | 491 // RenderFrameHost. |
| 492 // TODO(creis): Remove this in favor of FrameTree::ResetForMainFrameSwap. |
490 void AttachToFrameTree(); | 493 void AttachToFrameTree(); |
491 | 494 |
492 // The following IPC handlers are public so RenderFrameHost can call them, | 495 // The following IPC handlers are public so RenderFrameHost can call them, |
493 // while we transition the code to not use RenderViewHost. | 496 // while we transition the code to not use RenderViewHost. |
494 // | 497 // |
495 // TODO(nasko): Remove those methods once we are done moving navigation | 498 // TODO(nasko): Remove those methods once we are done moving navigation |
496 // into RenderFrameHost. | 499 // into RenderFrameHost. |
497 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 500 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
498 int64 parent_frame_id, | 501 int64 parent_frame_id, |
499 bool main_frame, | 502 bool main_frame, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 614 |
612 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 615 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
613 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 616 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
614 #endif | 617 #endif |
615 | 618 |
616 private: | 619 private: |
617 friend class TestRenderViewHost; | 620 friend class TestRenderViewHost; |
618 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost); | 621 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost); |
619 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane); | 622 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane); |
620 | 623 |
| 624 typedef base::hash_map<int64, int64> FrameIDMap; |
| 625 |
621 // Sets whether this RenderViewHost is swapped out in favor of another, | 626 // Sets whether this RenderViewHost is swapped out in favor of another, |
622 // and clears any waiting state that is no longer relevant. | 627 // and clears any waiting state that is no longer relevant. |
623 void SetSwappedOut(bool is_swapped_out); | 628 void SetSwappedOut(bool is_swapped_out); |
624 | 629 |
625 bool CanAccessFilesOfPageState(const PageState& state) const; | 630 bool CanAccessFilesOfPageState(const PageState& state) const; |
626 | 631 |
627 // Our delegate, which wants to know about changes in the RenderView. | 632 // Our delegate, which wants to know about changes in the RenderView. |
628 RenderViewHostDelegate* delegate_; | 633 RenderViewHostDelegate* delegate_; |
629 | 634 |
630 // The SiteInstance associated with this RenderViewHost. All pages drawn | 635 // The SiteInstance associated with this RenderViewHost. All pages drawn |
631 // in this RenderViewHost are part of this SiteInstance. Should not change | 636 // in this RenderViewHost are part of this SiteInstance. Should not change |
632 // over time. | 637 // over time. |
633 scoped_refptr<SiteInstanceImpl> instance_; | 638 scoped_refptr<SiteInstanceImpl> instance_; |
634 | 639 |
| 640 // Map of renderer-specific frame IDs to browser-global FrameTreeNode IDs. |
| 641 FrameIDMap frame_id_map_; |
| 642 |
635 // true if we are currently waiting for a response for drag context | 643 // true if we are currently waiting for a response for drag context |
636 // information. | 644 // information. |
637 bool waiting_for_drag_context_response_; | 645 bool waiting_for_drag_context_response_; |
638 | 646 |
639 // A bitwise OR of bindings types that have been enabled for this RenderView. | 647 // A bitwise OR of bindings types that have been enabled for this RenderView. |
640 // See BindingsPolicy for details. | 648 // See BindingsPolicy for details. |
641 int enabled_bindings_; | 649 int enabled_bindings_; |
642 | 650 |
643 // Whether we should buffer outgoing Navigate messages rather than sending | 651 // Whether we should buffer outgoing Navigate messages rather than sending |
644 // them. This will be true when a RenderViewHost is created for a cross-site | 652 // them. This will be true when a RenderViewHost is created for a cross-site |
(...skipping 14 matching lines...) Expand all Loading... |
659 bool has_accessed_initial_document_; | 667 bool has_accessed_initial_document_; |
660 | 668 |
661 // Whether this RenderViewHost is currently swapped out, such that the view is | 669 // Whether this RenderViewHost is currently swapped out, such that the view is |
662 // being rendered by another process. | 670 // being rendered by another process. |
663 bool is_swapped_out_; | 671 bool is_swapped_out_; |
664 | 672 |
665 // Whether this RenderView is responsible for displaying a subframe in a | 673 // Whether this RenderView is responsible for displaying a subframe in a |
666 // different process from its parent page. | 674 // different process from its parent page. |
667 bool is_subframe_; | 675 bool is_subframe_; |
668 | 676 |
669 // 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 | |
671 // process is terminated (in RenderProcessGone). | |
672 // TODO(creis): Remove this when we switch to routing IDs for frames. | |
673 int64 main_frame_id_; | |
674 | |
675 // Routing ID for the main frame's RenderFrameHost. | 677 // Routing ID for the main frame's RenderFrameHost. |
| 678 // TODO(creis): Does this need to be updated on a crash? |
676 int main_frame_routing_id_; | 679 int main_frame_routing_id_; |
677 | 680 |
678 // If we were asked to RunModal, then this will hold the reply_msg that we | 681 // If we were asked to RunModal, then this will hold the reply_msg that we |
679 // must return to the renderer to unblock it. | 682 // must return to the renderer to unblock it. |
680 IPC::Message* run_modal_reply_msg_; | 683 IPC::Message* run_modal_reply_msg_; |
681 // This will hold the routing id of the RenderView that opened us. | 684 // This will hold the routing id of the RenderView that opened us. |
682 int run_modal_opener_id_; | 685 int run_modal_opener_id_; |
683 | 686 |
684 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 687 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
685 // ensures we don't spam the renderer with multiple beforeunload requests. | 688 // ensures we don't spam the renderer with multiple beforeunload requests. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); | 737 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); |
735 }; | 738 }; |
736 | 739 |
737 #if defined(COMPILER_MSVC) | 740 #if defined(COMPILER_MSVC) |
738 #pragma warning(pop) | 741 #pragma warning(pop) |
739 #endif | 742 #endif |
740 | 743 |
741 } // namespace content | 744 } // namespace content |
742 | 745 |
743 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 746 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
OLD | NEW |