Commit e69ab016 authored by piman@chromium.org's avatar piman@chromium.org

Fix cursor in fullscreen pepper

BUG=chromium-os:14322
TEST=Pepper Flash on Youtube, go full screen


Review URL: http://codereview.chromium.org/7670008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97088 0039d316-1c4b-4281-b951-d872f2087c98
parent 4b436bc6
......@@ -38,8 +38,7 @@ class PepperWidget : public WebWidget {
PepperWidget(webkit::ppapi::PluginInstance* plugin,
RenderWidgetFullscreenPepper* widget)
: plugin_(plugin),
widget_(widget),
cursor_(WebCursorInfo::TypePointer) {
widget_(widget) {
}
virtual ~PepperWidget() {}
......@@ -97,7 +96,10 @@ class PepperWidget : public WebWidget {
}
virtual bool handleInputEvent(const WebInputEvent& event) {
bool result = plugin_->HandleInputEvent(event, &cursor_);
// This cursor info is ignored, we always set the cursor directly from
// RenderWidgetFullscreenPepper::DidChangeCursor.
WebCursorInfo cursor;
bool result = plugin_->HandleInputEvent(event, &cursor);
// For normal web pages, WebViewImpl does input event translations and
// generates context menu events. Since we don't have a WebView, we need to
......@@ -126,7 +128,7 @@ class PepperWidget : public WebWidget {
if (send_context_menu_event) {
WebMouseEvent context_menu_event(mouse_event);
context_menu_event.type = WebInputEvent::ContextMenu;
plugin_->HandleInputEvent(context_menu_event, &cursor_);
plugin_->HandleInputEvent(context_menu_event, &cursor);
}
}
return result;
......@@ -188,7 +190,6 @@ class PepperWidget : public WebWidget {
scoped_refptr<webkit::ppapi::PluginInstance> plugin_;
RenderWidgetFullscreenPepper* widget_;
WebSize size_;
WebCursorInfo cursor_;
DISALLOW_COPY_AND_ASSIGN(PepperWidget);
};
......@@ -262,6 +263,11 @@ void RenderWidgetFullscreenPepper::Destroy() {
Send(new ViewHostMsg_Close(routing_id_));
}
void RenderWidgetFullscreenPepper::DidChangeCursor(
const WebKit::WebCursorInfo& cursor) {
didChangeCursor(cursor);
}
webkit::ppapi::PluginDelegate::PlatformContext3D*
RenderWidgetFullscreenPepper::CreateContext3D() {
if (!context_) {
......
......@@ -35,6 +35,7 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen,
virtual void InvalidateRect(const WebKit::WebRect& rect);
virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect);
virtual void Destroy();
virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor);
virtual webkit::ppapi::PluginDelegate::PlatformContext3D* CreateContext3D();
RendererGLContext* context() const { return context_; }
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -8,6 +8,7 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
namespace WebKit {
struct WebCursorInfo;
struct WebRect;
} // namespace WebKit
......@@ -33,6 +34,9 @@ class FullscreenContainer {
// instance.
virtual void Destroy() = 0;
// Notifies the container that the mouse cursor has changed.
virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor) = 0;
virtual PluginDelegate::PlatformContext3D* CreateContext3D() = 0;
};
......
......@@ -359,7 +359,7 @@ bool PluginInstance::SetCursor(PP_CursorType_Dev type,
PP_Resource custom_image,
const PP_Point* hot_spot) {
if (type != PP_CURSORTYPE_CUSTOM) {
cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type)));
DoSetCursor(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type)));
return true;
}
......@@ -402,7 +402,7 @@ bool PluginInstance::SetCursor(PP_CursorType_Dev type,
return false;
#endif
cursor_.reset(custom_cursor.release());
DoSetCursor(custom_cursor.release());
return true;
}
......@@ -1545,5 +1545,11 @@ void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) {
delegate()->SubscribeToPolicyUpdates(this);
}
void PluginInstance::DoSetCursor(WebCursorInfo* cursor) {
cursor_.reset(cursor);
if (fullscreen_container_)
fullscreen_container_->DidChangeCursor(*cursor);
}
} // namespace ppapi
} // namespace webkit
......@@ -343,6 +343,8 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
int num_ranges,
WebKit::WebCanvas* canvas);
void DoSetCursor(WebKit::WebCursorInfo* cursor);
PluginDelegate* delegate_;
scoped_refptr<PluginModule> module_;
scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment