| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/renderer/render_widget_fullscreen_pepper.h" | 5 #include "chrome/renderer/render_widget_fullscreen_pepper.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/renderer/render_thread.h" | 8 #include "chrome/renderer/render_thread.h" |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebWidget.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebWidget.h" |
| 12 #include "webkit/glue/plugins/pepper_fullscreen_container.h" | 12 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 13 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 13 #include "webkit/plugins/ppapi/plugin_instance.h" |
| 14 | 14 |
| 15 using WebKit::WebCanvas; | 15 using WebKit::WebCanvas; |
| 16 using WebKit::WebCompositionUnderline; | 16 using WebKit::WebCompositionUnderline; |
| 17 using WebKit::WebCursorInfo; | 17 using WebKit::WebCursorInfo; |
| 18 using WebKit::WebInputEvent; | 18 using WebKit::WebInputEvent; |
| 19 using WebKit::WebRect; | 19 using WebKit::WebRect; |
| 20 using WebKit::WebSize; | 20 using WebKit::WebSize; |
| 21 using WebKit::WebString; | 21 using WebKit::WebString; |
| 22 using WebKit::WebTextDirection; | 22 using WebKit::WebTextDirection; |
| 23 using WebKit::WebTextInputType; | 23 using WebKit::WebTextInputType; |
| 24 using WebKit::WebVector; | 24 using WebKit::WebVector; |
| 25 using WebKit::WebWidget; | 25 using WebKit::WebWidget; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // WebWidget that simply wraps the pepper plugin. | 29 // WebWidget that simply wraps the pepper plugin. |
| 30 class PepperWidget : public WebWidget { | 30 class PepperWidget : public WebWidget { |
| 31 public: | 31 public: |
| 32 PepperWidget(pepper::PluginInstance* plugin, | 32 PepperWidget(webkit::plugins::ppapi::PluginInstance* plugin, |
| 33 RenderWidgetFullscreenPepper* widget) | 33 RenderWidgetFullscreenPepper* widget) |
| 34 : plugin_(plugin), | 34 : plugin_(plugin), |
| 35 widget_(widget), | 35 widget_(widget), |
| 36 cursor_(WebCursorInfo::TypePointer) { | 36 cursor_(WebCursorInfo::TypePointer) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 // WebWidget API | 39 // WebWidget API |
| 40 virtual void close() { | 40 virtual void close() { |
| 41 delete this; | 41 delete this; |
| 42 } | 42 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 virtual void setTextDirection(WebTextDirection) { | 112 virtual void setTextDirection(WebTextDirection) { |
| 113 NOTIMPLEMENTED(); | 113 NOTIMPLEMENTED(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 virtual bool isAcceleratedCompositingActive() const { | 116 virtual bool isAcceleratedCompositingActive() const { |
| 117 // TODO(piman): see if supporting accelerated compositing makes sense. | 117 // TODO(piman): see if supporting accelerated compositing makes sense. |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 pepper::PluginInstance* plugin_; | 122 webkit::plugins::ppapi::PluginInstance* plugin_; |
| 123 RenderWidgetFullscreenPepper* widget_; | 123 RenderWidgetFullscreenPepper* widget_; |
| 124 WebSize size_; | 124 WebSize size_; |
| 125 WebCursorInfo cursor_; | 125 WebCursorInfo cursor_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 127 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 | 130 |
| 131 // A FullscreenContainer that forwards the API calls to the | 131 // A FullscreenContainer that forwards the API calls to the |
| 132 // RenderWidgetFullscreenPepper. | 132 // RenderWidgetFullscreenPepper. |
| 133 class WidgetFullscreenContainer : public pepper::FullscreenContainer { | 133 class WidgetFullscreenContainer |
| 134 : public webkit::plugins::ppapi::FullscreenContainer { |
| 134 public: | 135 public: |
| 135 explicit WidgetFullscreenContainer(RenderWidgetFullscreenPepper* widget) | 136 explicit WidgetFullscreenContainer(RenderWidgetFullscreenPepper* widget) |
| 136 : widget_(widget) { | 137 : widget_(widget) { |
| 137 } | 138 } |
| 138 virtual ~WidgetFullscreenContainer() { } | 139 virtual ~WidgetFullscreenContainer() { } |
| 139 | 140 |
| 140 virtual void Invalidate() { | 141 virtual void Invalidate() { |
| 141 widget_->GenerateFullRepaint(); | 142 widget_->GenerateFullRepaint(); |
| 142 } | 143 } |
| 143 | 144 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 157 RenderWidgetFullscreenPepper* widget_; | 158 RenderWidgetFullscreenPepper* widget_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(WidgetFullscreenContainer); | 160 DISALLOW_COPY_AND_ASSIGN(WidgetFullscreenContainer); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // anonymous namespace | 163 } // anonymous namespace |
| 163 | 164 |
| 164 // static | 165 // static |
| 165 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( | 166 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( |
| 166 int32 opener_id, RenderThreadBase* render_thread, | 167 int32 opener_id, RenderThreadBase* render_thread, |
| 167 pepper::PluginInstance* plugin) { | 168 webkit::plugins::ppapi::PluginInstance* plugin) { |
| 168 DCHECK_NE(MSG_ROUTING_NONE, opener_id); | 169 DCHECK_NE(MSG_ROUTING_NONE, opener_id); |
| 169 scoped_refptr<RenderWidgetFullscreenPepper> widget( | 170 scoped_refptr<RenderWidgetFullscreenPepper> widget( |
| 170 new RenderWidgetFullscreenPepper(render_thread, plugin)); | 171 new RenderWidgetFullscreenPepper(render_thread, plugin)); |
| 171 widget->Init(opener_id); | 172 widget->Init(opener_id); |
| 172 return widget.release(); | 173 return widget.release(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( | 176 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( |
| 176 RenderThreadBase* render_thread, pepper::PluginInstance* plugin) | 177 RenderThreadBase* render_thread, |
| 178 webkit::plugins::ppapi::PluginInstance* plugin) |
| 177 : RenderWidgetFullscreen(render_thread, WebKit::WebPopupTypeSelect), | 179 : RenderWidgetFullscreen(render_thread, WebKit::WebPopupTypeSelect), |
| 178 plugin_(plugin), | 180 plugin_(plugin), |
| 179 ALLOW_THIS_IN_INITIALIZER_LIST( | 181 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 180 container_(new WidgetFullscreenContainer(this))) { | 182 container_(new WidgetFullscreenContainer(this))) { |
| 181 } | 183 } |
| 182 | 184 |
| 183 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() { | 185 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() { |
| 184 } | 186 } |
| 185 | 187 |
| 186 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { | 188 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 const gfx::Rect& paint_bounds, | 221 const gfx::Rect& paint_bounds, |
| 220 TransportDIB** dib, | 222 TransportDIB** dib, |
| 221 gfx::Rect* location, | 223 gfx::Rect* location, |
| 222 gfx::Rect* clip) { | 224 gfx::Rect* clip) { |
| 223 if (plugin_) { | 225 if (plugin_) { |
| 224 return plugin_->GetBitmapForOptimizedPluginPaint( | 226 return plugin_->GetBitmapForOptimizedPluginPaint( |
| 225 paint_bounds, dib, location, clip); | 227 paint_bounds, dib, location, clip); |
| 226 } | 228 } |
| 227 return false; | 229 return false; |
| 228 } | 230 } |
| OLD | NEW |