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

Side by Side Diff: content/renderer/render_view_impl.h

Issue 2498463002: RenderWidget/RenderView: encapsulate ViewHostMsg_Show, etc, in a callback (Closed)
Patch Set: Remove RenderWidgetFullscreen Created 4 years 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_RENDERER_RENDER_VIEW_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 struct WebWindowFeatures; 91 struct WebWindowFeatures;
92 92
93 #if defined(OS_ANDROID) 93 #if defined(OS_ANDROID)
94 class WebHitTestResult; 94 class WebHitTestResult;
95 #endif 95 #endif
96 } // namespace blink 96 } // namespace blink
97 97
98 namespace content { 98 namespace content {
99 99
100 class HistoryController; 100 class HistoryController;
101 class RendererDateTimePicker;
101 class RenderViewImplTest; 102 class RenderViewImplTest;
102 class RenderViewObserver; 103 class RenderViewObserver;
103 class RenderViewTest; 104 class RenderViewTest;
104 class RendererDateTimePicker;
105 class SpeechRecognitionDispatcher; 105 class SpeechRecognitionDispatcher;
106 struct FaviconURL; 106 struct FaviconURL;
107 struct FileChooserParams; 107 struct FileChooserParams;
108 struct ResizeParams; 108 struct ResizeParams;
109 109
110 namespace mojom { 110 namespace mojom {
111 class CreateViewParams; 111 class CreateViewParams;
112 } 112 }
113 113
114 // 114 //
115 // RenderView is an object that manages a WebView object, and provides a 115 // RenderView is an object that manages a WebView object, and provides a
116 // communication interface with an embedding application process. 116 // communication interface with an embedding application process.
117 // 117 //
118 // DEPRECATED: RenderViewImpl is being removed as part of the SiteIsolation 118 // DEPRECATED: RenderViewImpl is being removed as part of the SiteIsolation
119 // project. New code should be added to RenderFrameImpl instead. 119 // project. New code should be added to RenderFrameImpl instead.
120 // 120 //
121 // For context, please see https://crbug.com/467770 and 121 // For context, please see https://crbug.com/467770 and
122 // http://www.chromium.org/developers/design-documents/site-isolation. 122 // http://www.chromium.org/developers/design-documents/site-isolation.
123 class CONTENT_EXPORT RenderViewImpl 123 class CONTENT_EXPORT RenderViewImpl
124 : public RenderWidget, 124 : public RenderWidget,
125 NON_EXPORTED_BASE(public blink::WebViewClient), 125 NON_EXPORTED_BASE(public blink::WebViewClient),
126 public RenderWidgetOwnerDelegate, 126 public RenderWidgetOwnerDelegate,
127 public RenderView, 127 public RenderView,
128 public base::SupportsWeakPtr<RenderViewImpl> { 128 public base::SupportsWeakPtr<RenderViewImpl> {
129 public: 129 public:
130 // Creates a new RenderView. |opener_id| is the routing ID of the RenderView 130 // Creates a new RenderView. Note that if the original opener has been closed,
131 // responsible for creating this RenderView. Note that if the original opener 131 // |params.window_was_created_with_opener| will be true and
132 // has been closed, |window_was_created_with_opener| will be true and 132 // |params.opener_frame_route_id| will be MSG_ROUTING_NONE. When
133 // |opener_id| will be MSG_ROUTING_NONE. When |swapped_out| is true, the 133 // |params.swapped_out| is true, |params.proxy_routing_id| is specified, so a
134 // |proxy_routing_id| is specified, so a RenderFrameProxy can be created for 134 // RenderFrameProxy can be created for this RenderView's main RenderFrame. The
135 // this RenderView's main RenderFrame. 135 // opener should provide a non-null value for |show_callback| if it needs to
136 static RenderViewImpl* Create(CompositorDependencies* compositor_deps, 136 // send an additional IPC to finish making this view visible.
137 const mojom::CreateViewParams& params, 137 static RenderViewImpl* Create(
138 bool was_created_by_renderer); 138 CompositorDependencies* compositor_deps,
139 const mojom::CreateViewParams& params,
140 const RenderWidget::ShowCallback& show_callback);
139 141
140 // Used by content_layouttest_support to hook into the creation of 142 // Used by content_layouttest_support to hook into the creation of
141 // RenderViewImpls. 143 // RenderViewImpls.
142 static void InstallCreateHook(RenderViewImpl* (*create_render_view_impl)( 144 static void InstallCreateHook(RenderViewImpl* (*create_render_view_impl)(
143 CompositorDependencies* compositor_deps, 145 CompositorDependencies* compositor_deps,
144 const mojom::CreateViewParams&)); 146 const mojom::CreateViewParams&));
145 147
146 // Returns the RenderViewImpl containing the given WebView. 148 // Returns the RenderViewImpl containing the given WebView.
147 static RenderViewImpl* FromWebView(blink::WebView* webview); 149 static RenderViewImpl* FromWebView(blink::WebView* webview);
148 150
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const blink::WebActiveWheelFlingParameters& params); 219 const blink::WebActiveWheelFlingParameters& params);
218 220
219 // Starts a timer to send an UpdateState message on behalf of |frame|, if the 221 // Starts a timer to send an UpdateState message on behalf of |frame|, if the
220 // timer isn't already running. This allows multiple state changing events to 222 // timer isn't already running. This allows multiple state changing events to
221 // be coalesced into one update. 223 // be coalesced into one update.
222 void StartNavStateSyncTimerIfNecessary(RenderFrameImpl* frame); 224 void StartNavStateSyncTimerIfNecessary(RenderFrameImpl* frame);
223 225
224 // Synchronously sends the current navigation state to the browser. 226 // Synchronously sends the current navigation state to the browser.
225 void SendUpdateState(); 227 void SendUpdateState();
226 228
229 // A popup widget opened by this view needs to be shown.
230 void ShowCreatedPopupWidget(RenderWidget* popup_widget,
231 blink::WebNavigationPolicy policy,
232 const gfx::Rect& initial_rect);
233 // A RenderWidgetFullscreen widget opened by this view needs to be shown.
234 void ShowCreatedFullscreenWidget(RenderWidget* fullscreen_widget,
235 blink::WebNavigationPolicy policy,
236 const gfx::Rect& initial_rect);
237 // A RenderView widget opened by this view needs to be shown.
238 void ShowCreatedViewWidget(bool opened_by_user_gesture,
239 RenderWidget* render_view,
240 blink::WebNavigationPolicy policy,
241 const gfx::Rect& initial_rect);
242
227 // Returns the length of the session history of this RenderView. Note that 243 // Returns the length of the session history of this RenderView. Note that
228 // this only coincides with the actual length of the session history if this 244 // this only coincides with the actual length of the session history if this
229 // RenderView is the currently active RenderView of a WebContents. 245 // RenderView is the currently active RenderView of a WebContents.
230 unsigned GetLocalSessionHistoryLengthForTesting() const; 246 unsigned GetLocalSessionHistoryLengthForTesting() const;
231 247
232 // Invokes OnSetFocus and marks the widget as active depending on the value 248 // Invokes OnSetFocus and marks the widget as active depending on the value
233 // of |enable|. This is used for layout tests that need to control the focus 249 // of |enable|. This is used for layout tests that need to control the focus
234 // synchronously from the renderer. 250 // synchronously from the renderer.
235 void SetFocusAndActivateForTesting(bool enable); 251 void SetFocusAndActivateForTesting(bool enable);
236 252
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 void OnOrientationChange() override; 416 void OnOrientationChange() override;
401 void DidCommitCompositorFrame() override; 417 void DidCommitCompositorFrame() override;
402 void DidCompletePageScaleAnimation() override; 418 void DidCompletePageScaleAnimation() override;
403 void OnDeviceScaleFactorChanged() override; 419 void OnDeviceScaleFactorChanged() override;
404 void ResizeWebWidget() override; 420 void ResizeWebWidget() override;
405 421
406 RenderViewImpl(CompositorDependencies* compositor_deps, 422 RenderViewImpl(CompositorDependencies* compositor_deps,
407 const mojom::CreateViewParams& params); 423 const mojom::CreateViewParams& params);
408 424
409 void Initialize(const mojom::CreateViewParams& params, 425 void Initialize(const mojom::CreateViewParams& params,
410 bool was_created_by_renderer); 426 const RenderWidget::ShowCallback& show_callback);
411 void SetScreenMetricsEmulationParameters( 427 void SetScreenMetricsEmulationParameters(
412 bool enabled, 428 bool enabled,
413 const blink::WebDeviceEmulationParams& params) override; 429 const blink::WebDeviceEmulationParams& params) override;
414 430
415 // Do not delete directly. This class is reference counted. 431 // Do not delete directly. This class is reference counted.
416 ~RenderViewImpl() override; 432 ~RenderViewImpl() override;
417 433
418 private: 434 private:
419 // For unit tests. 435 // For unit tests.
420 friend class DevToolsAgentTest; 436 friend class DevToolsAgentTest;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // because if the view grows beyond a size known to the browser, scroll bars 709 // because if the view grows beyond a size known to the browser, scroll bars
694 // should be drawn. 710 // should be drawn.
695 gfx::Size disable_scrollbars_size_limit_; 711 gfx::Size disable_scrollbars_size_limit_;
696 712
697 // Loading state ------------------------------------------------------------- 713 // Loading state -------------------------------------------------------------
698 714
699 // The gesture that initiated the current navigation. 715 // The gesture that initiated the current navigation.
700 // TODO(nasko): Move to RenderFrame, as this is per-frame state. 716 // TODO(nasko): Move to RenderFrame, as this is per-frame state.
701 NavigationGesture navigation_gesture_; 717 NavigationGesture navigation_gesture_;
702 718
703 // Used for popups.
704 bool opened_by_user_gesture_;
705
706 // Timer used to delay the updating of nav state (see 719 // Timer used to delay the updating of nav state (see
707 // StartNavStateSyncTimerIfNecessary). 720 // StartNavStateSyncTimerIfNecessary).
708 base::OneShotTimer nav_state_sync_timer_; 721 base::OneShotTimer nav_state_sync_timer_;
709 722
710 // Set of RenderFrame routing IDs for frames that having pending UpdateState 723 // Set of RenderFrame routing IDs for frames that having pending UpdateState
711 // messages to send when the next |nav_state_sync_timer_| fires. 724 // messages to send when the next |nav_state_sync_timer_| fires.
712 std::set<int> frames_with_pending_state_; 725 std::set<int> frames_with_pending_state_;
713 726
714 // History list -------------------------------------------------------------- 727 // History list --------------------------------------------------------------
715 728
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 // Expected id of the next content intent launched. Used to prevent scheduled 833 // Expected id of the next content intent launched. Used to prevent scheduled
821 // intents to be launched if aborted. 834 // intents to be launched if aborted.
822 size_t expected_content_intent_id_; 835 size_t expected_content_intent_id_;
823 836
824 // List of click-based content detectors. 837 // List of click-based content detectors.
825 std::vector<std::unique_ptr<ContentDetector>> content_detectors_; 838 std::vector<std::unique_ptr<ContentDetector>> content_detectors_;
826 839
827 // A date/time picker object for date and time related input elements. 840 // A date/time picker object for date and time related input elements.
828 std::unique_ptr<RendererDateTimePicker> date_time_picker_client_; 841 std::unique_ptr<RendererDateTimePicker> date_time_picker_client_;
829 842
843 // Whether this was a renderer-created or browser-created RenderView.
844 bool was_created_by_renderer_;
830 #endif 845 #endif
831 846
832 // Misc ---------------------------------------------------------------------- 847 // Misc ----------------------------------------------------------------------
833 848
834 // The current directory enumeration callback 849 // The current directory enumeration callback
835 std::map<int, blink::WebFileChooserCompletion*> enumeration_completions_; 850 std::map<int, blink::WebFileChooserCompletion*> enumeration_completions_;
836 int enumeration_completion_id_; 851 int enumeration_completion_id_;
837 852
838 // The SessionStorage namespace that we're assigned to has an ID, and that ID 853 // The SessionStorage namespace that we're assigned to has an ID, and that ID
839 // is passed to us upon creation. WebKit asks for this ID upon first use and 854 // is passed to us upon creation. WebKit asks for this ID upon first use and
(...skipping 21 matching lines...) Expand all
861 // use the Observer interface to filter IPC messages and receive frame change 876 // use the Observer interface to filter IPC messages and receive frame change
862 // notifications. 877 // notifications.
863 // --------------------------------------------------------------------------- 878 // ---------------------------------------------------------------------------
864 879
865 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); 880 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
866 }; 881 };
867 882
868 } // namespace content 883 } // namespace content
869 884
870 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 885 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698