Chromium Code Reviews| 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/ggl/ggl.h" | 8 #include "chrome/renderer/ggl/ggl.h" |
| 9 #include "chrome/renderer/gpu_channel_host.h" | 9 #include "chrome/renderer/gpu_channel_host.h" |
| 10 #include "chrome/renderer/pepper_platform_context_3d_impl.h" | 10 #include "chrome/renderer/pepper_platform_context_3d_impl.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 widget_->Invalidate(); | 56 widget_->Invalidate(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void animate() { | 59 virtual void animate() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void layout() { | 62 virtual void layout() { |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void paint(WebCanvas* canvas, const WebRect& rect) { | 65 virtual void paint(WebCanvas* canvas, const WebRect& rect) { |
| 66 if (!plugin_) | |
| 67 return; | |
| 68 WebRect plugin_rect(0, 0, size_.width, size_.height); | 66 WebRect plugin_rect(0, 0, size_.width, size_.height); |
| 69 plugin_->Paint(canvas, plugin_rect, rect); | 67 plugin_->Paint(canvas, plugin_rect, rect); |
| 70 } | 68 } |
| 71 | 69 |
| 72 virtual void composite(bool finish) { | 70 virtual void composite(bool finish) { |
| 73 ggl::Context* context = widget_->context(); | 71 ggl::Context* context = widget_->context(); |
| 74 DCHECK(context); | 72 DCHECK(context); |
| 75 gpu::gles2::GLES2Implementation* gl = ggl::GetImplementation(context); | 73 gpu::gles2::GLES2Implementation* gl = ggl::GetImplementation(context); |
| 76 unsigned int texture = plugin_->GetBackingTextureId(); | 74 unsigned int texture = plugin_->GetBackingTextureId(); |
| 77 gl->BindTexture(GL_TEXTURE_2D, texture); | 75 gl->BindTexture(GL_TEXTURE_2D, texture); |
| 78 gl->DrawArrays(GL_TRIANGLES, 0, 3); | 76 gl->DrawArrays(GL_TRIANGLES, 0, 3); |
| 79 ggl::SwapBuffers(context); | 77 ggl::SwapBuffers(context); |
| 80 } | 78 } |
| 81 | 79 |
| 82 virtual void themeChanged() { | 80 virtual void themeChanged() { |
| 83 NOTIMPLEMENTED(); | 81 NOTIMPLEMENTED(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 virtual bool handleInputEvent(const WebInputEvent& event) { | 84 virtual bool handleInputEvent(const WebInputEvent& event) { |
| 87 if (!plugin_) | |
| 88 return false; | |
| 89 return plugin_->HandleInputEvent(event, &cursor_); | 85 return plugin_->HandleInputEvent(event, &cursor_); |
| 90 } | 86 } |
| 91 | 87 |
| 92 virtual void mouseCaptureLost() { | 88 virtual void mouseCaptureLost() { |
| 93 NOTIMPLEMENTED(); | 89 NOTIMPLEMENTED(); |
| 94 } | 90 } |
| 95 | 91 |
| 96 virtual void setFocus(bool focus) { | 92 virtual void setFocus(bool focus) { |
| 97 NOTIMPLEMENTED(); | 93 NOTIMPLEMENTED(); |
| 98 } | 94 } |
| 99 | 95 |
| 96 // TODO(piman): figure out IME and implement these if necessary. | |
|
viettrungluu
2011/03/08 00:06:01
Does leaving in the NOTIMPLEMENTED()s result in a
piman
2011/03/08 00:55:30
Yes, 2 per frame when in full-screen, including in
| |
| 100 virtual bool setComposition( | 97 virtual bool setComposition( |
| 101 const WebString& text, | 98 const WebString& text, |
| 102 const WebVector<WebCompositionUnderline>& underlines, | 99 const WebVector<WebCompositionUnderline>& underlines, |
| 103 int selectionStart, | 100 int selectionStart, |
| 104 int selectionEnd) { | 101 int selectionEnd) { |
| 105 NOTIMPLEMENTED(); | |
| 106 return false; | 102 return false; |
| 107 } | 103 } |
| 108 | 104 |
| 109 virtual bool confirmComposition() { | 105 virtual bool confirmComposition() { |
| 110 NOTIMPLEMENTED(); | |
| 111 return false; | 106 return false; |
| 112 } | 107 } |
| 113 | 108 |
| 114 virtual bool confirmComposition(const WebString& text) { | 109 virtual bool confirmComposition(const WebString& text) { |
| 115 NOTIMPLEMENTED(); | |
| 116 return false; | 110 return false; |
| 117 } | 111 } |
| 118 | 112 |
| 119 virtual WebTextInputType textInputType() { | 113 virtual WebTextInputType textInputType() { |
| 120 NOTIMPLEMENTED(); | |
| 121 return WebKit::WebTextInputTypeNone; | 114 return WebKit::WebTextInputTypeNone; |
| 122 } | 115 } |
| 123 | 116 |
| 124 virtual WebRect caretOrSelectionBounds() { | 117 virtual WebRect caretOrSelectionBounds() { |
| 125 NOTIMPLEMENTED(); | |
| 126 return WebRect(); | 118 return WebRect(); |
| 127 } | 119 } |
| 128 | 120 |
| 129 virtual void setTextDirection(WebTextDirection) { | 121 virtual void setTextDirection(WebTextDirection) { |
| 130 NOTIMPLEMENTED(); | |
| 131 } | 122 } |
| 132 | 123 |
| 133 virtual bool isAcceleratedCompositingActive() const { | 124 virtual bool isAcceleratedCompositingActive() const { |
| 134 return widget_->context() && plugin_ && | 125 return widget_->context() && (plugin_->GetBackingTextureId() != 0); |
| 135 (plugin_->GetBackingTextureId() != 0); | |
| 136 } | 126 } |
| 137 | 127 |
| 138 private: | 128 private: |
| 139 webkit::ppapi::PluginInstance* plugin_; | 129 scoped_refptr<webkit::ppapi::PluginInstance> plugin_; |
| 140 RenderWidgetFullscreenPepper* widget_; | 130 RenderWidgetFullscreenPepper* widget_; |
| 141 WebSize size_; | 131 WebSize size_; |
| 142 WebCursorInfo cursor_; | 132 WebCursorInfo cursor_; |
| 143 | 133 |
| 144 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 134 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
| 145 }; | 135 }; |
| 146 | 136 |
| 147 } // anonymous namespace | 137 } // anonymous namespace |
| 148 | 138 |
| 149 // static | 139 // static |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 } | 205 } |
| 216 | 206 |
| 217 void RenderWidgetFullscreenPepper::DidFlushPaint() { | 207 void RenderWidgetFullscreenPepper::DidFlushPaint() { |
| 218 if (plugin_) | 208 if (plugin_) |
| 219 plugin_->ViewFlushedPaint(); | 209 plugin_->ViewFlushedPaint(); |
| 220 } | 210 } |
| 221 | 211 |
| 222 void RenderWidgetFullscreenPepper::Close() { | 212 void RenderWidgetFullscreenPepper::Close() { |
| 223 // If the fullscreen window is closed (e.g. user pressed escape), reset to | 213 // If the fullscreen window is closed (e.g. user pressed escape), reset to |
| 224 // normal mode. | 214 // normal mode. |
| 225 if (plugin_) | 215 if (plugin_) |
|
viettrungluu
2011/03/08 00:06:01
Why do you sometimes check |plugin_| and sometimes
piman
2011/03/08 00:55:30
The RenderWidgetFullscreenPepper checks for it bec
| |
| 226 plugin_->SetFullscreen(false); | 216 plugin_->SetFullscreen(false, false); |
| 227 } | 217 } |
| 228 | 218 |
| 229 webkit::ppapi::PluginInstance* | 219 webkit::ppapi::PluginInstance* |
| 230 RenderWidgetFullscreenPepper::GetBitmapForOptimizedPluginPaint( | 220 RenderWidgetFullscreenPepper::GetBitmapForOptimizedPluginPaint( |
| 231 const gfx::Rect& paint_bounds, | 221 const gfx::Rect& paint_bounds, |
| 232 TransportDIB** dib, | 222 TransportDIB** dib, |
| 233 gfx::Rect* location, | 223 gfx::Rect* location, |
| 234 gfx::Rect* clip) { | 224 gfx::Rect* clip) { |
| 235 if (plugin_ && | 225 if (plugin_ && |
| 236 plugin_->GetBitmapForOptimizedPluginPaint(paint_bounds, dib, | 226 plugin_->GetBitmapForOptimizedPluginPaint(paint_bounds, dib, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 return true; | 386 return true; |
| 397 } | 387 } |
| 398 | 388 |
| 399 bool RenderWidgetFullscreenPepper::CheckCompositing() { | 389 bool RenderWidgetFullscreenPepper::CheckCompositing() { |
| 400 bool compositing = webwidget_->isAcceleratedCompositingActive(); | 390 bool compositing = webwidget_->isAcceleratedCompositingActive(); |
| 401 if (compositing != is_accelerated_compositing_active_) { | 391 if (compositing != is_accelerated_compositing_active_) { |
| 402 didActivateAcceleratedCompositing(compositing); | 392 didActivateAcceleratedCompositing(compositing); |
| 403 } | 393 } |
| 404 return compositing; | 394 return compositing; |
| 405 } | 395 } |
| OLD | NEW |