Chromium Code Reviews| 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 #include "content/renderer/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 bool unlocked_by_target) { | 123 bool unlocked_by_target) { |
| 124 widget_->Send(new ViewHostMsg_LockMouse(widget_->routing_id(), false, | 124 widget_->Send(new ViewHostMsg_LockMouse(widget_->routing_id(), false, |
| 125 unlocked_by_target, true)); | 125 unlocked_by_target, true)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void FullscreenMouseLockDispatcher::SendUnlockMouseRequest() { | 128 void FullscreenMouseLockDispatcher::SendUnlockMouseRequest() { |
| 129 widget_->Send(new ViewHostMsg_UnlockMouse(widget_->routing_id())); | 129 widget_->Send(new ViewHostMsg_UnlockMouse(widget_->routing_id())); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // WebWidget that simply wraps the pepper plugin. | 132 // WebWidget that simply wraps the pepper plugin. |
| 133 // TODO(piman): figure out IME and implement setComposition and friends if | |
| 134 // necessary. | |
| 133 class PepperWidget : public WebWidget { | 135 class PepperWidget : public WebWidget { |
| 134 public: | 136 public: |
| 135 explicit PepperWidget(RenderWidgetFullscreenPepper* widget) | 137 explicit PepperWidget(RenderWidgetFullscreenPepper* widget) |
| 136 : widget_(widget) { | 138 : widget_(widget) { |
| 137 } | 139 } |
| 138 | 140 |
| 139 virtual ~PepperWidget() {} | 141 virtual ~PepperWidget() {} |
| 140 | 142 |
| 141 // WebWidget API | 143 // WebWidget API |
| 142 virtual void close() { | 144 virtual void close() { |
| 143 delete this; | 145 delete this; |
| 144 } | 146 } |
| 145 | 147 |
| 146 virtual WebSize size() { | 148 virtual WebSize size() { |
| 147 return size_; | 149 return size_; |
| 148 } | 150 } |
| 149 | 151 |
| 150 virtual void willStartLiveResize() { | |
| 151 } | |
| 152 | |
| 153 virtual void resize(const WebSize& size) { | 152 virtual void resize(const WebSize& size) { |
| 154 if (!widget_->plugin()) | 153 if (!widget_->plugin()) |
| 155 return; | 154 return; |
| 156 | 155 |
| 157 size_ = size; | 156 size_ = size; |
| 158 WebRect plugin_rect(0, 0, size_.width, size_.height); | 157 WebRect plugin_rect(0, 0, size_.width, size_.height); |
| 159 widget_->plugin()->ViewChanged(plugin_rect, plugin_rect, | 158 widget_->plugin()->ViewChanged(plugin_rect, plugin_rect, |
| 160 std::vector<gfx::Rect>()); | 159 std::vector<gfx::Rect>()); |
| 161 widget_->Invalidate(); | 160 widget_->Invalidate(); |
| 162 } | 161 } |
| 163 | 162 |
| 164 virtual void willEndLiveResize() { | |
| 165 } | |
| 166 | |
| 167 virtual void animate(double frameBeginTime) { | |
| 168 } | |
| 169 | |
| 170 virtual void layout() { | |
| 171 } | |
| 172 | |
| 173 virtual void setCompositorSurfaceReady() { | |
| 174 } | |
| 175 | |
| 176 virtual void composite(bool finish) { | |
| 177 } | |
| 178 | |
| 179 virtual void themeChanged() { | 163 virtual void themeChanged() { |
| 180 NOTIMPLEMENTED(); | 164 NOTIMPLEMENTED(); |
| 181 } | 165 } |
| 182 | 166 |
| 183 virtual bool handleInputEvent(const WebInputEvent& event) { | 167 virtual bool handleInputEvent(const WebInputEvent& event) { |
| 184 if (!widget_->plugin()) | 168 if (!widget_->plugin()) |
| 185 return false; | 169 return false; |
| 186 | 170 |
| 187 // This cursor info is ignored, we always set the cursor directly from | 171 // This cursor info is ignored, we always set the cursor directly from |
| 188 // RenderWidgetFullscreenPepper::DidChangeCursor. | 172 // RenderWidgetFullscreenPepper::DidChangeCursor. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 #endif | 245 #endif |
| 262 if (send_context_menu_event) { | 246 if (send_context_menu_event) { |
| 263 WebMouseEvent context_menu_event(mouse_event); | 247 WebMouseEvent context_menu_event(mouse_event); |
| 264 context_menu_event.type = WebInputEvent::ContextMenu; | 248 context_menu_event.type = WebInputEvent::ContextMenu; |
| 265 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); | 249 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); |
| 266 } | 250 } |
| 267 } | 251 } |
| 268 return result; | 252 return result; |
| 269 } | 253 } |
| 270 | 254 |
| 271 virtual void mouseCaptureLost() { | |
| 272 } | |
| 273 | |
| 274 virtual void setFocus(bool focus) { | |
| 275 } | |
| 276 | |
| 277 // TODO(piman): figure out IME and implement these if necessary. | |
| 278 virtual bool setComposition( | |
| 279 const WebString& text, | |
| 280 const WebVector<WebCompositionUnderline>& underlines, | |
| 281 int selectionStart, | |
| 282 int selectionEnd) { | |
| 283 return false; | |
| 284 } | |
| 285 | |
| 286 virtual bool confirmComposition() { | |
| 287 return false; | |
| 288 } | |
| 289 | |
| 290 virtual bool compositionRange(size_t* location, size_t* length) { | |
| 291 return false; | |
| 292 } | |
| 293 | |
| 294 virtual bool confirmComposition(const WebString& text) { | |
| 295 return false; | |
| 296 } | |
| 297 | |
| 298 virtual WebTextInputType textInputType() { | |
| 299 return blink::WebTextInputTypeNone; | |
| 300 } | |
| 301 | |
| 302 virtual WebRect caretOrSelectionBounds() { | |
| 303 return WebRect(); | |
| 304 } | |
| 305 | |
| 306 virtual bool selectionRange(WebPoint& start, WebPoint& end) const { | |
| 307 return false; | |
| 308 } | |
| 309 | |
| 310 virtual bool caretOrSelectionRange(size_t* location, size_t* length) { | |
| 311 return false; | |
| 312 } | |
| 313 | |
| 314 virtual void setTextDirection(WebTextDirection) { | |
| 315 } | |
| 316 | |
| 317 virtual bool isAcceleratedCompositingActive() const { | |
| 318 return widget_->plugin() && widget_->is_compositing(); | |
|
piman
2014/05/02 23:38:53
I think you can remove is_compositing() now.
danakj
2014/05/02 23:40:58
Done.
| |
| 319 } | |
| 320 | |
| 321 private: | 255 private: |
| 322 RenderWidgetFullscreenPepper* widget_; | 256 RenderWidgetFullscreenPepper* widget_; |
| 323 WebSize size_; | 257 WebSize size_; |
| 324 | 258 |
| 325 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 259 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
| 326 }; | 260 }; |
| 327 | 261 |
| 328 } // anonymous namespace | 262 } // anonymous namespace |
| 329 | 263 |
| 330 // static | 264 // static |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 } | 395 } |
| 462 | 396 |
| 463 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( | 397 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( |
| 464 float device_scale_factor) { | 398 float device_scale_factor) { |
| 465 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 399 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 466 if (compositor_) | 400 if (compositor_) |
| 467 compositor_->setDeviceScaleFactor(device_scale_factor); | 401 compositor_->setDeviceScaleFactor(device_scale_factor); |
| 468 } | 402 } |
| 469 | 403 |
| 470 } // namespace content | 404 } // namespace content |
| OLD | NEW |