Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.h

Issue 16032007: Create RenderFrame/RenderFrameHost for the main frame of a page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added basic renderer and browser test for existence. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "content/browser/renderer_host/render_frame_host_impl.h"
17 #include "content/browser/renderer_host/render_widget_host_impl.h" 18 #include "content/browser/renderer_host/render_widget_host_impl.h"
18 #include "content/browser/site_instance_impl.h" 19 #include "content/browser/site_instance_impl.h"
19 #include "content/common/accessibility_node_data.h" 20 #include "content/common/accessibility_node_data.h"
20 #include "content/common/drag_event_source_info.h" 21 #include "content/common/drag_event_source_info.h"
21 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/render_view_host.h" 23 #include "content/public/browser/render_view_host.h"
23 #include "content/public/common/javascript_message_type.h" 24 #include "content/public/common/javascript_message_type.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"
26 #include "third_party/skia/include/core/SkColor.h" 27 #include "third_party/skia/include/core/SkColor.h"
(...skipping 28 matching lines...) Expand all
55 namespace media { 56 namespace media {
56 class MediaPlayerManager; 57 class MediaPlayerManager;
57 } 58 }
58 #endif 59 #endif
59 60
60 namespace content { 61 namespace content {
61 62
62 class ChildProcessSecurityPolicyImpl; 63 class ChildProcessSecurityPolicyImpl;
63 class PageState; 64 class PageState;
64 class PowerSaveBlocker; 65 class PowerSaveBlocker;
66 class RenderFrameHostImpl;
65 class RenderViewHostObserver; 67 class RenderViewHostObserver;
66 class RenderWidgetHostDelegate; 68 class RenderWidgetHostDelegate;
67 class SessionStorageNamespace; 69 class SessionStorageNamespace;
68 class SessionStorageNamespaceImpl; 70 class SessionStorageNamespaceImpl;
69 class TestRenderViewHost; 71 class TestRenderViewHost;
70 struct ContextMenuParams; 72 struct ContextMenuParams;
71 struct FileChooserParams; 73 struct FileChooserParams;
72 struct Referrer; 74 struct Referrer;
73 struct ShowDesktopNotificationHostMsgParams; 75 struct ShowDesktopNotificationHostMsgParams;
74 76
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // The |session_storage_namespace| parameter allows multiple render views and 115 // The |session_storage_namespace| parameter allows multiple render views and
114 // WebContentses to share the same session storage (part of the WebStorage 116 // WebContentses to share the same session storage (part of the WebStorage
115 // spec) space. This is useful when restoring contentses, but most callers 117 // spec) space. This is useful when restoring contentses, but most callers
116 // should pass in NULL which will cause a new SessionStorageNamespace to be 118 // should pass in NULL which will cause a new SessionStorageNamespace to be
117 // created. 119 // created.
118 RenderViewHostImpl( 120 RenderViewHostImpl(
119 SiteInstance* instance, 121 SiteInstance* instance,
120 RenderViewHostDelegate* delegate, 122 RenderViewHostDelegate* delegate,
121 RenderWidgetHostDelegate* widget_delegate, 123 RenderWidgetHostDelegate* widget_delegate,
122 int routing_id, 124 int routing_id,
125 int main_frame_routing_id,
123 bool swapped_out, 126 bool swapped_out,
124 SessionStorageNamespace* session_storage_namespace); 127 SessionStorageNamespace* session_storage_namespace);
125 virtual ~RenderViewHostImpl(); 128 virtual ~RenderViewHostImpl();
126 129
127 // RenderViewHost implementation. 130 // RenderViewHost implementation.
128 virtual void AllowBindings(int binding_flags) OVERRIDE; 131 virtual void AllowBindings(int binding_flags) OVERRIDE;
129 virtual void ClearFocusedNode() OVERRIDE; 132 virtual void ClearFocusedNode() OVERRIDE;
130 virtual void ClosePage() OVERRIDE; 133 virtual void ClosePage() OVERRIDE;
131 virtual void CopyImageAt(int x, int y) OVERRIDE; 134 virtual void CopyImageAt(int x, int y) OVERRIDE;
132 virtual void DisassociateFromPopupCount() OVERRIDE; 135 virtual void DisassociateFromPopupCount() OVERRIDE;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 virtual void ForwardMouseEvent( 360 virtual void ForwardMouseEvent(
358 const WebKit::WebMouseEvent& mouse_event) OVERRIDE; 361 const WebKit::WebMouseEvent& mouse_event) OVERRIDE;
359 virtual void OnPointerEventActivate() OVERRIDE; 362 virtual void OnPointerEventActivate() OVERRIDE;
360 virtual void ForwardKeyboardEvent( 363 virtual void ForwardKeyboardEvent(
361 const NativeWebKeyboardEvent& key_event) OVERRIDE; 364 const NativeWebKeyboardEvent& key_event) OVERRIDE;
362 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; 365 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
363 366
364 // Creates a new RenderView with the given route id. 367 // Creates a new RenderView with the given route id.
365 void CreateNewWindow( 368 void CreateNewWindow(
366 int route_id, 369 int route_id,
370 int main_frame_route_id,
367 const ViewHostMsg_CreateWindow_Params& params, 371 const ViewHostMsg_CreateWindow_Params& params,
368 SessionStorageNamespace* session_storage_namespace); 372 SessionStorageNamespace* session_storage_namespace);
369 373
370 // Creates a new RenderWidget with the given route id. |popup_type| indicates 374 // Creates a new RenderWidget with the given route id. |popup_type| indicates
371 // if this widget is a popup and what kind of popup it is (select, autofill). 375 // if this widget is a popup and what kind of popup it is (select, autofill).
372 void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); 376 void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
373 377
374 // Creates a full screen RenderWidget. 378 // Creates a full screen RenderWidget.
375 void CreateNewFullscreenWidget(int route_id); 379 void CreateNewFullscreenWidget(int route_id);
376 380
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 void OnRunFileChooser(const FileChooserParams& params); 563 void OnRunFileChooser(const FileChooserParams& params);
560 void OnDomOperationResponse(const std::string& json_string, 564 void OnDomOperationResponse(const std::string& json_string,
561 int automation_id); 565 int automation_id);
562 void OnGetWindowSnapshot(const int snapshot_id); 566 void OnGetWindowSnapshot(const int snapshot_id);
563 567
564 #if defined(OS_MACOSX) || defined(OS_ANDROID) 568 #if defined(OS_MACOSX) || defined(OS_ANDROID)
565 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); 569 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params);
566 #endif 570 #endif
567 571
568 private: 572 private:
569 friend class TestRenderViewHost; 573 friend class TestRenderViewHost;
Charlie Reis 2013/05/30 00:41:53 Ah, in this case, we have a TestRenderViewHost fri
nasko 2013/05/30 17:07:03 TestRenderViewHost is used only in unit tests, isn
Charlie Reis 2013/05/30 18:26:59 Good point! Guess we do need it.
nasko 2013/05/30 19:03:48 Done.
574 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost);
570 575
571 // Sets whether this RenderViewHost is swapped out in favor of another, 576 // Sets whether this RenderViewHost is swapped out in favor of another,
572 // and clears any waiting state that is no longer relevant. 577 // and clears any waiting state that is no longer relevant.
573 void SetSwappedOut(bool is_swapped_out); 578 void SetSwappedOut(bool is_swapped_out);
574 579
575 void ClearPowerSaveBlockers(); 580 void ClearPowerSaveBlockers();
576 581
577 bool CanAccessFilesOfPageState(const PageState& state) const; 582 bool CanAccessFilesOfPageState(const PageState& state) const;
578 583
584 scoped_ptr<RenderFrameHostImpl> main_render_frame_host_;
Charlie Reis 2013/05/30 00:41:53 This needs a comment.
nasko 2013/05/30 17:07:03 Done.
585
579 // Our delegate, which wants to know about changes in the RenderView. 586 // Our delegate, which wants to know about changes in the RenderView.
580 RenderViewHostDelegate* delegate_; 587 RenderViewHostDelegate* delegate_;
581 588
582 // The SiteInstance associated with this RenderViewHost. All pages drawn 589 // The SiteInstance associated with this RenderViewHost. All pages drawn
583 // in this RenderViewHost are part of this SiteInstance. Should not change 590 // in this RenderViewHost are part of this SiteInstance. Should not change
584 // over time. 591 // over time.
585 scoped_refptr<SiteInstanceImpl> instance_; 592 scoped_refptr<SiteInstanceImpl> instance_;
586 593
587 // true if we are currently waiting for a response for drag context 594 // true if we are currently waiting for a response for drag context
588 // information. 595 // information.
(...skipping 28 matching lines...) Expand all
617 624
618 // Whether this RenderView is responsible for displaying a subframe in a 625 // Whether this RenderView is responsible for displaying a subframe in a
619 // different process from its parent page. 626 // different process from its parent page.
620 bool is_subframe_; 627 bool is_subframe_;
621 628
622 // The frame id of the main (top level) frame. This value is set on the 629 // The frame id of the main (top level) frame. This value is set on the
623 // initial navigation of a RenderView and reset when the RenderView is 630 // initial navigation of a RenderView and reset when the RenderView is
624 // terminated (in RenderViewGone). 631 // terminated (in RenderViewGone).
625 int64 main_frame_id_; 632 int64 main_frame_id_;
626 633
634 int main_frame_routing_id_;
Charlie Reis 2013/05/30 00:41:53 Why would we store this, rather than asking main_r
nasko 2013/05/30 17:07:03 I added it in previous iterations and it looks red
635
627 // If we were asked to RunModal, then this will hold the reply_msg that we 636 // If we were asked to RunModal, then this will hold the reply_msg that we
628 // must return to the renderer to unblock it. 637 // must return to the renderer to unblock it.
629 IPC::Message* run_modal_reply_msg_; 638 IPC::Message* run_modal_reply_msg_;
630 // This will hold the routing id of the RenderView that opened us. 639 // This will hold the routing id of the RenderView that opened us.
631 int run_modal_opener_id_; 640 int run_modal_opener_id_;
632 641
633 // Set to true when there is a pending ViewMsg_ShouldClose message. This 642 // Set to true when there is a pending ViewMsg_ShouldClose message. This
634 // ensures we don't spam the renderer with multiple beforeunload requests. 643 // ensures we don't spam the renderer with multiple beforeunload requests.
635 // When either this value or is_waiting_for_unload_ack_ is true, the value of 644 // When either this value or is_waiting_for_unload_ack_ is true, the value of
636 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a 645 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); 706 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
698 }; 707 };
699 708
700 #if defined(COMPILER_MSVC) 709 #if defined(COMPILER_MSVC)
701 #pragma warning(pop) 710 #pragma warning(pop)
702 #endif 711 #endif
703 712
704 } // namespace content 713 } // namespace content
705 714
706 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 715 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698