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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 float GetOriginalDeviceScaleFactor() const; | 396 float GetOriginalDeviceScaleFactor() const; |
397 | 397 |
398 protected: | 398 protected: |
399 // Friend RefCounted so that the dtor can be non-public. Using this class | 399 // Friend RefCounted so that the dtor can be non-public. Using this class |
400 // without ref-counting is an error. | 400 // without ref-counting is an error. |
401 friend class base::RefCounted<RenderWidget>; | 401 friend class base::RefCounted<RenderWidget>; |
402 | 402 |
403 // For unit tests. | 403 // For unit tests. |
404 friend class RenderWidgetTest; | 404 friend class RenderWidgetTest; |
405 | 405 |
| 406 using CreateWidgetCallback = base::OnceCallback<bool()>; |
| 407 |
406 enum ResizeAck { | 408 enum ResizeAck { |
407 SEND_RESIZE_ACK, | 409 SEND_RESIZE_ACK, |
408 NO_RESIZE_ACK, | 410 NO_RESIZE_ACK, |
409 }; | 411 }; |
410 | 412 |
411 RenderWidget(CompositorDependencies* compositor_deps, | 413 RenderWidget(CompositorDependencies* compositor_deps, |
412 blink::WebPopupType popup_type, | 414 blink::WebPopupType popup_type, |
413 const ScreenInfo& screen_info, | 415 const ScreenInfo& screen_info, |
414 bool swapped_out, | 416 bool swapped_out, |
415 bool hidden, | 417 bool hidden, |
416 bool never_visible); | 418 bool never_visible); |
417 | 419 |
418 ~RenderWidget() override; | 420 ~RenderWidget() override; |
419 | 421 |
420 static blink::WebFrameWidget* CreateWebFrameWidget( | 422 static blink::WebFrameWidget* CreateWebFrameWidget( |
421 RenderWidget* render_widget, | 423 RenderWidget* render_widget, |
422 blink::WebLocalFrame* frame); | 424 blink::WebLocalFrame* frame); |
423 | 425 |
424 // Creates a WebWidget based on the popup type. | 426 // Creates a WebWidget based on the popup type. |
425 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); | 427 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
426 | 428 |
427 // Initializes this view with the given opener. | 429 // Initializes this view with the given opener. |
428 bool Init(int32_t opener_id); | 430 bool Init(int32_t opener_id); |
429 | 431 |
430 // Called by Init and subclasses to perform initialization. | 432 // Called by Init and subclasses to perform initialization. |
431 bool DoInit(int32_t opener_id, | 433 bool DoInit(int32_t opener_id, |
432 blink::WebWidget* web_widget, | 434 blink::WebWidget* web_widget, |
433 IPC::SyncMessage* create_widget_message); | 435 CreateWidgetCallback create_widget_callback); |
434 | 436 |
435 // Allows the process to exit once the unload handler has finished, if there | 437 // Allows the process to exit once the unload handler has finished, if there |
436 // are no other active RenderWidgets. | 438 // are no other active RenderWidgets. |
437 void WasSwappedOut(); | 439 void WasSwappedOut(); |
438 | 440 |
439 void DoDeferredClose(); | 441 void DoDeferredClose(); |
440 void NotifyOnClose(); | 442 void NotifyOnClose(); |
441 | 443 |
442 gfx::Size GetSizeForWebWidget() const; | 444 gfx::Size GetSizeForWebWidget() const; |
443 virtual void ResizeWebWidget(); | 445 virtual void ResizeWebWidget(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 799 |
798 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. | 800 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
799 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; | 801 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
800 | 802 |
801 private: | 803 private: |
802 // Applies/Removes the DevTools device emulation transformation to/from a | 804 // Applies/Removes the DevTools device emulation transformation to/from a |
803 // window rect. | 805 // window rect. |
804 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; | 806 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
805 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; | 807 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
806 | 808 |
| 809 bool CreateWidget(int32_t opener_id, |
| 810 blink::WebPopupType popup_type, |
| 811 int32_t* routing_id); |
| 812 |
807 // Indicates whether this widget has focus. | 813 // Indicates whether this widget has focus. |
808 bool has_focus_; | 814 bool has_focus_; |
809 | 815 |
810 #if defined(OS_MACOSX) | 816 #if defined(OS_MACOSX) |
811 // Responds to IPCs from TextInputClientMac regarding getting string at given | 817 // Responds to IPCs from TextInputClientMac regarding getting string at given |
812 // position or range as well as finding character index at a given position. | 818 // position or range as well as finding character index at a given position. |
813 std::unique_ptr<TextInputClientObserver> text_input_client_observer_; | 819 std::unique_ptr<TextInputClientObserver> text_input_client_observer_; |
814 #endif | 820 #endif |
815 | 821 |
816 // This reference is set by the RenderFrame and is used to query the IME- | 822 // This reference is set by the RenderFrame and is used to query the IME- |
817 // related state from the plugin to later send to the browser. | 823 // related state from the plugin to later send to the browser. |
818 PepperPluginInstanceImpl* focused_pepper_plugin_; | 824 PepperPluginInstanceImpl* focused_pepper_plugin_; |
819 | 825 |
820 // Stores edit commands associated to the next key event. | 826 // Stores edit commands associated to the next key event. |
821 // Will be cleared as soon as the next key event is processed. | 827 // Will be cleared as soon as the next key event is processed. |
822 EditCommands edit_commands_; | 828 EditCommands edit_commands_; |
823 | 829 |
824 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 830 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
825 }; | 831 }; |
826 | 832 |
827 } // namespace content | 833 } // namespace content |
828 | 834 |
829 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 835 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |