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

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

Issue 1962923002: Fix rendering of flash content inside an out-of-process iframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for android builds Created 4 years, 7 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
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_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
11 #include <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <memory> 13 #include <memory>
14 #include <set>
14 15
15 #include "base/callback.h" 16 #include "base/callback.h"
16 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 21 #include "base/observer_list.h"
20 #include "base/time/time.h" 22 #include "base/time/time.h"
21 #include "build/build_config.h" 23 #include "build/build_config.h"
22 #include "content/common/content_export.h" 24 #include "content/common/content_export.h"
23 #include "content/common/cursors/webcursor.h" 25 #include "content/common/cursors/webcursor.h"
24 #include "content/common/input/synthetic_gesture_params.h" 26 #include "content/common/input/synthetic_gesture_params.h"
25 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega te.h" 27 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega te.h"
26 #include "content/renderer/gpu/render_widget_compositor_delegate.h" 28 #include "content/renderer/gpu/render_widget_compositor_delegate.h"
27 #include "content/renderer/input/render_widget_input_handler.h" 29 #include "content/renderer/input/render_widget_input_handler.h"
28 #include "content/renderer/input/render_widget_input_handler_delegate.h" 30 #include "content/renderer/input/render_widget_input_handler_delegate.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 79
78 namespace scheduler { 80 namespace scheduler {
79 class RenderWidgetSchedulingState; 81 class RenderWidgetSchedulingState;
80 } 82 }
81 83
82 namespace content { 84 namespace content {
83 class CompositorDependencies; 85 class CompositorDependencies;
84 class ExternalPopupMenu; 86 class ExternalPopupMenu;
85 class FrameSwapMessageQueue; 87 class FrameSwapMessageQueue;
86 class ImeEventGuard; 88 class ImeEventGuard;
89 class PepperPluginInstanceImpl;
87 class RenderFrameImpl; 90 class RenderFrameImpl;
88 class RenderFrameProxy; 91 class RenderFrameProxy;
89 class RenderWidgetCompositor; 92 class RenderWidgetCompositor;
90 class RenderWidgetOwnerDelegate; 93 class RenderWidgetOwnerDelegate;
91 class RenderWidgetScreenMetricsEmulator; 94 class RenderWidgetScreenMetricsEmulator;
92 class ResizingModeSelector; 95 class ResizingModeSelector;
93 struct ContextMenuParams; 96 struct ContextMenuParams;
94 struct DidOverscrollParams; 97 struct DidOverscrollParams;
95 struct ResizeParams; 98 struct ResizeParams;
96 99
97 // RenderWidget provides a communication bridge between a WebWidget and 100 // RenderWidget provides a communication bridge between a WebWidget and
98 // a RenderWidgetHost, the latter of which lives in a different process. 101 // a RenderWidgetHost, the latter of which lives in a different process.
99 // 102 //
100 // RenderWidget is used to implement: 103 // RenderWidget is used to implement:
101 // - RenderViewImpl (deprecated) 104 // - RenderViewImpl (deprecated)
102 // - Fullscreen mode (RenderWidgetFullScreen) 105 // - Fullscreen mode (RenderWidgetFullScreen)
103 // - Popup "menus" (like the color chooser and date picker) 106 // - Popup "menus" (like the color chooser and date picker)
104 // - Widgets for frames (for out-of-process iframe support) 107 // - Widgets for frames (for out-of-process iframe support)
105 class CONTENT_EXPORT RenderWidget 108 class CONTENT_EXPORT RenderWidget
106 : public IPC::Listener, 109 : public IPC::Listener,
107 public IPC::Sender, 110 public IPC::Sender,
108 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), 111 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
109 public RenderWidgetCompositorDelegate, 112 public RenderWidgetCompositorDelegate,
110 public RenderWidgetInputHandlerDelegate, 113 public RenderWidgetInputHandlerDelegate,
111 public RenderWidgetScreenMetricsEmulatorDelegate, 114 public RenderWidgetScreenMetricsEmulatorDelegate,
112 public base::RefCounted<RenderWidget> { 115 public base::RefCounted<RenderWidget>,
116 public base::SupportsWeakPtr<RenderWidget> {
113 public: 117 public:
114 // Creates a new RenderWidget. The opener_id is the routing ID of the 118 // Creates a new RenderWidget. The opener_id is the routing ID of the
115 // RenderView that this widget lives inside. 119 // RenderView that this widget lives inside.
116 static RenderWidget* Create(int32_t opener_id, 120 static RenderWidget* Create(int32_t opener_id,
117 CompositorDependencies* compositor_deps, 121 CompositorDependencies* compositor_deps,
118 blink::WebPopupType popup_type, 122 blink::WebPopupType popup_type,
119 const blink::WebScreenInfo& screen_info); 123 const blink::WebScreenInfo& screen_info);
120 124
121 // Creates a new RenderWidget that will be attached to a RenderFrame. 125 // Creates a new RenderWidget that will be attached to a RenderFrame.
122 static RenderWidget* CreateForFrame(int routing_id, 126 static RenderWidget* CreateForFrame(int routing_id,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Checks if the composition range or composition character bounds have been 357 // Checks if the composition range or composition character bounds have been
354 // changed. If they are changed, the new value will be sent to the browser 358 // changed. If they are changed, the new value will be sent to the browser
355 // process. This method does nothing when the browser process is not able to 359 // process. This method does nothing when the browser process is not able to
356 // handle composition range and composition character bounds. 360 // handle composition range and composition character bounds.
357 void UpdateCompositionInfo(bool should_update_range); 361 void UpdateCompositionInfo(bool should_update_range);
358 362
359 // Change the device ICC color profile while running a layout test. 363 // Change the device ICC color profile while running a layout test.
360 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); 364 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
361 void ResetDeviceColorProfileForTesting(); 365 void ResetDeviceColorProfileForTesting();
362 366
367 // Plugin-related functions --------------------------------------------------
368
369 #if defined(ENABLE_PLUGINS)
370 PepperPluginInstanceImpl* focused_pepper_plugin() {
371 return focused_pepper_plugin_;
372 }
373 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
374 return pepper_last_mouse_event_target_;
375 }
376 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
377 pepper_last_mouse_event_target_ = plugin;
378 }
379
380 // Indicates that the given instance has been created.
381 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
382
383 // Indicates that the given instance is being destroyed. This is called from
384 // the destructor, so it's important that the instance is not dereferenced
385 // from this call.
386 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
387
388 // Notification that the given plugin is focused or unfocused.
389 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
390 #endif // ENABLE_PLUGINS
391
363 protected: 392 protected:
364 // Friend RefCounted so that the dtor can be non-public. Using this class 393 // Friend RefCounted so that the dtor can be non-public. Using this class
365 // without ref-counting is an error. 394 // without ref-counting is an error.
366 friend class base::RefCounted<RenderWidget>; 395 friend class base::RefCounted<RenderWidget>;
367 396
368 // For unit tests. 397 // For unit tests.
369 friend class RenderWidgetTest; 398 friend class RenderWidgetTest;
370 399
371 enum ResizeAck { 400 enum ResizeAck {
372 SEND_RESIZE_ACK, 401 SEND_RESIZE_ACK,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 base::ObserverList<RenderFrameProxy> render_frame_proxies_; 770 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
742 #if defined(VIDEO_HOLE) 771 #if defined(VIDEO_HOLE)
743 base::ObserverList<RenderFrameImpl> video_hole_frames_; 772 base::ObserverList<RenderFrameImpl> video_hole_frames_;
744 #endif // defined(VIDEO_HOLE) 773 #endif // defined(VIDEO_HOLE)
745 774
746 // A list of RenderFrames associated with this RenderWidget. Notifications 775 // A list of RenderFrames associated with this RenderWidget. Notifications
747 // are sent to each frame in the list for events such as changing 776 // are sent to each frame in the list for events such as changing
748 // visibility state for example. 777 // visibility state for example.
749 base::ObserverList<RenderFrameImpl> render_frames_; 778 base::ObserverList<RenderFrameImpl> render_frames_;
750 779
780 // Plugins -------------------------------------------------------------------
781 #if defined(ENABLE_PLUGINS)
782 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
783 PepperPluginSet active_pepper_instances_;
784
785 // TODO(jam): these belong on RenderFrame, once the browser knows which frame
786 // is focused and sends the IPCs which use these to the correct frame. Until
787 // then, we must store these on RenderView as that's the one place that knows
788 // about all the RenderFrames for a page.
789
790 // Whether or not the focus is on a PPAPI plugin
791 PepperPluginInstanceImpl* focused_pepper_plugin_;
792
793 // The plugin instance that received the last mouse event. It is set to NULL
794 // if the last mouse event went to elements other than Pepper plugins.
795 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
796 // the RenderFrameImpl to NULL it out when it destructs.
797 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
798 #endif
799
751 bool has_host_context_menu_location_; 800 bool has_host_context_menu_location_;
752 gfx::Point host_context_menu_location_; 801 gfx::Point host_context_menu_location_;
753 802
754 std::unique_ptr<scheduler::RenderWidgetSchedulingState> 803 std::unique_ptr<scheduler::RenderWidgetSchedulingState>
755 render_widget_scheduling_state_; 804 render_widget_scheduling_state_;
756 805
757 private: 806 private:
758 // When emulated, this returns original device scale factor. 807 // When emulated, this returns original device scale factor.
759 float GetOriginalDeviceScaleFactor() const; 808 float GetOriginalDeviceScaleFactor() const;
760 809
761 DISALLOW_COPY_AND_ASSIGN(RenderWidget); 810 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
762 }; 811 };
763 812
764 } // namespace content 813 } // namespace content
765 814
766 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ 815 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698