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_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 // Creates a new RenderWidget that will be attached to a RenderFrame. | 136 // Creates a new RenderWidget that will be attached to a RenderFrame. |
137 static RenderWidget* CreateForFrame(int widget_routing_id, | 137 static RenderWidget* CreateForFrame(int widget_routing_id, |
138 bool hidden, | 138 bool hidden, |
139 const ScreenInfo& screen_info, | 139 const ScreenInfo& screen_info, |
140 CompositorDependencies* compositor_deps, | 140 CompositorDependencies* compositor_deps, |
141 blink::WebLocalFrame* frame); | 141 blink::WebLocalFrame* frame); |
142 | 142 |
143 // Used by content_layouttest_support to hook into the creation of | 143 // Used by content_layouttest_support to hook into the creation of |
144 // RenderWidgets. | 144 // RenderWidgets. |
145 using CreateRenderWidgetFunction = | 145 using CreateRenderWidgetFunction = RenderWidget* (*)(int32_t, |
146 RenderWidget* (*)(CompositorDependencies*, | 146 CompositorDependencies*, |
147 blink::WebPopupType, | 147 blink::WebPopupType, |
148 const ScreenInfo&, | 148 const ScreenInfo&, |
149 bool, | 149 bool, |
150 bool, | 150 bool, |
151 bool); | 151 bool); |
152 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); | 152 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); |
153 static void InstallCreateHook( | 153 static void InstallCreateHook( |
154 CreateRenderWidgetFunction create_render_widget, | 154 CreateRenderWidgetFunction create_render_widget, |
155 RenderWidgetInitializedCallback render_widget_initialized_callback); | 155 RenderWidgetInitializedCallback render_widget_initialized_callback); |
156 | 156 |
157 // Closes a RenderWidget that was created by |CreateForFrame|. | 157 // Closes a RenderWidget that was created by |CreateForFrame|. |
158 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. | 158 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. |
159 // https://crbug.com/545684 | 159 // https://crbug.com/545684 |
160 virtual void CloseForFrame(); | 160 virtual void CloseForFrame(); |
161 | 161 |
162 int32_t routing_id() const { | 162 int32_t routing_id() const { return routing_id_; } |
163 return routing_id_; | |
164 } | |
165 | 163 |
166 CompositorDependencies* compositor_deps() const { return compositor_deps_; } | 164 CompositorDependencies* compositor_deps() const { return compositor_deps_; } |
167 virtual blink::WebWidget* GetWebWidget() const; | 165 virtual blink::WebWidget* GetWebWidget() const; |
168 | 166 |
169 // Returns the current instance of WebInputMethodController which is to be | 167 // Returns the current instance of WebInputMethodController which is to be |
170 // used for IME related tasks. This instance corresponds to the one from | 168 // used for IME related tasks. This instance corresponds to the one from |
171 // focused frame and can be nullptr. | 169 // focused frame and can be nullptr. |
172 blink::WebInputMethodController* GetInputMethodController() const; | 170 blink::WebInputMethodController* GetInputMethodController() const; |
173 | 171 |
174 const gfx::Size& size() const { return size_; } | 172 const gfx::Size& size() const { return size_; } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 friend class base::RefCounted<RenderWidget>; | 417 friend class base::RefCounted<RenderWidget>; |
420 | 418 |
421 // For unit tests. | 419 // For unit tests. |
422 friend class RenderWidgetTest; | 420 friend class RenderWidgetTest; |
423 | 421 |
424 enum ResizeAck { | 422 enum ResizeAck { |
425 SEND_RESIZE_ACK, | 423 SEND_RESIZE_ACK, |
426 NO_RESIZE_ACK, | 424 NO_RESIZE_ACK, |
427 }; | 425 }; |
428 | 426 |
429 RenderWidget(CompositorDependencies* compositor_deps, | 427 RenderWidget(int32_t widget_routing_id, |
| 428 CompositorDependencies* compositor_deps, |
430 blink::WebPopupType popup_type, | 429 blink::WebPopupType popup_type, |
431 const ScreenInfo& screen_info, | 430 const ScreenInfo& screen_info, |
432 bool swapped_out, | 431 bool swapped_out, |
433 bool hidden, | 432 bool hidden, |
434 bool never_visible); | 433 bool never_visible); |
435 | 434 |
436 ~RenderWidget() override; | 435 ~RenderWidget() override; |
437 | 436 |
438 static blink::WebFrameWidget* CreateWebFrameWidget( | 437 static blink::WebFrameWidget* CreateWebFrameWidget( |
439 RenderWidget* render_widget, | 438 RenderWidget* render_widget, |
440 blink::WebLocalFrame* frame); | 439 blink::WebLocalFrame* frame); |
441 | 440 |
442 // Creates a WebWidget based on the popup type. | 441 // Creates a WebWidget based on the popup type. |
443 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); | 442 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
444 | 443 |
445 // Called by Create() functions and subclasses, after the routing_id is | |
446 // available. Must be called before Init(). | |
447 void InitRoutingID(int32_t routing_id); | |
448 | |
449 // Called by Create() functions and subclasses to finish initialization. | 444 // Called by Create() functions and subclasses to finish initialization. |
450 void Init(int32_t opener_id, blink::WebWidget* web_widget); | 445 void Init(int32_t opener_id, blink::WebWidget* web_widget); |
451 | 446 |
452 // Allows the process to exit once the unload handler has finished, if there | 447 // Allows the process to exit once the unload handler has finished, if there |
453 // are no other active RenderWidgets. | 448 // are no other active RenderWidgets. |
454 void WasSwappedOut(); | 449 void WasSwappedOut(); |
455 | 450 |
456 void DoDeferredClose(); | 451 void DoDeferredClose(); |
457 void NotifyOnClose(); | 452 void NotifyOnClose(); |
458 | 453 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 void setTouchAction(blink::WebTouchAction touch_action) override; | 596 void setTouchAction(blink::WebTouchAction touch_action) override; |
602 | 597 |
603 // Called when value of focused text field gets dirty, e.g. value is modified | 598 // Called when value of focused text field gets dirty, e.g. value is modified |
604 // by script, not by user input. | 599 // by script, not by user input. |
605 void didUpdateTextOfFocusedElementByNonUserInput() override; | 600 void didUpdateTextOfFocusedElementByNonUserInput() override; |
606 | 601 |
607 // Sends an ACK to the browser process during the next compositor frame. | 602 // Sends an ACK to the browser process during the next compositor frame. |
608 void OnWaitNextFrameForTests(int routing_id); | 603 void OnWaitNextFrameForTests(int routing_id); |
609 | 604 |
610 // Routing ID that allows us to communicate to the parent browser process | 605 // Routing ID that allows us to communicate to the parent browser process |
611 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. | 606 // RenderWidgetHost. |
612 int32_t routing_id_; | 607 const int32_t routing_id_; |
613 | 608 |
614 // Dependencies for initializing a compositor, including flags for optional | 609 // Dependencies for initializing a compositor, including flags for optional |
615 // features. | 610 // features. |
616 CompositorDependencies* const compositor_deps_; | 611 CompositorDependencies* const compositor_deps_; |
617 | 612 |
618 // Use GetWebWidget() instead of using webwidget_internal_ directly. | 613 // Use GetWebWidget() instead of using webwidget_internal_ directly. |
619 // We are responsible for destroying this object via its Close method. | 614 // We are responsible for destroying this object via its Close method. |
620 // May be NULL when the window is closing. | 615 // May be NULL when the window is closing. |
621 blink::WebWidget* webwidget_internal_; | 616 blink::WebWidget* webwidget_internal_; |
622 | 617 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 // being handled. If the current event results in starting a drag/drop | 823 // being handled. If the current event results in starting a drag/drop |
829 // session, this info is sent to the browser along with other drag/drop info. | 824 // session, this info is sent to the browser along with other drag/drop info. |
830 DragEventSourceInfo possible_drag_event_info_; | 825 DragEventSourceInfo possible_drag_event_info_; |
831 | 826 |
832 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 827 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
833 }; | 828 }; |
834 | 829 |
835 } // namespace content | 830 } // namespace content |
836 | 831 |
837 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 832 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |