Clarify/fix fullscreen semantics, and add GetScreenSize
BUG=none TEST=youtube, nba, amazon Review URL: http://codereview.chromium.org/6625034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77229 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome/renderer
ppapi
c
cpp
proxy
webkit/plugins/ppapi
@ -40,6 +40,7 @@
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserCompletion.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/size.h"
|
||||
@ -867,6 +868,11 @@ PepperPluginDelegateImpl::CreateFullscreenContainer(
|
||||
return render_view_->CreatePepperFullscreenContainer(instance);
|
||||
}
|
||||
|
||||
gfx::Size PepperPluginDelegateImpl::GetScreenSize() {
|
||||
WebKit::WebScreenInfo info = render_view_->screenInfo();
|
||||
return gfx::Size(info.rect.width, info.rect.height);
|
||||
}
|
||||
|
||||
std::string PepperPluginDelegateImpl::GetDefaultEncoding() {
|
||||
// TODO(brettw) bug 56615: Somehow get the preference for the default
|
||||
// encoding here rather than using the global default for the UI language.
|
||||
|
@ -167,6 +167,7 @@ class PepperPluginDelegateImpl
|
||||
virtual webkit::ppapi::FullscreenContainer*
|
||||
CreateFullscreenContainer(
|
||||
webkit::ppapi::PluginInstance* instance);
|
||||
virtual gfx::Size GetScreenSize();
|
||||
virtual std::string GetDefaultEncoding();
|
||||
virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor);
|
||||
virtual std::string ResolveProxy(const GURL& url);
|
||||
|
@ -63,8 +63,6 @@ class PepperWidget : public WebWidget {
|
||||
}
|
||||
|
||||
virtual void paint(WebCanvas* canvas, const WebRect& rect) {
|
||||
if (!plugin_)
|
||||
return;
|
||||
WebRect plugin_rect(0, 0, size_.width, size_.height);
|
||||
plugin_->Paint(canvas, plugin_rect, rect);
|
||||
}
|
||||
@ -84,8 +82,6 @@ class PepperWidget : public WebWidget {
|
||||
}
|
||||
|
||||
virtual bool handleInputEvent(const WebInputEvent& event) {
|
||||
if (!plugin_)
|
||||
return false;
|
||||
return plugin_->HandleInputEvent(event, &cursor_);
|
||||
}
|
||||
|
||||
@ -97,46 +93,40 @@ class PepperWidget : public WebWidget {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
// TODO(piman): figure out IME and implement these if necessary.
|
||||
virtual bool setComposition(
|
||||
const WebString& text,
|
||||
const WebVector<WebCompositionUnderline>& underlines,
|
||||
int selectionStart,
|
||||
int selectionEnd) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool confirmComposition() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool confirmComposition(const WebString& text) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual WebTextInputType textInputType() {
|
||||
NOTIMPLEMENTED();
|
||||
return WebKit::WebTextInputTypeNone;
|
||||
}
|
||||
|
||||
virtual WebRect caretOrSelectionBounds() {
|
||||
NOTIMPLEMENTED();
|
||||
return WebRect();
|
||||
}
|
||||
|
||||
virtual void setTextDirection(WebTextDirection) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
virtual bool isAcceleratedCompositingActive() const {
|
||||
return widget_->context() && plugin_ &&
|
||||
(plugin_->GetBackingTextureId() != 0);
|
||||
return widget_->context() && (plugin_->GetBackingTextureId() != 0);
|
||||
}
|
||||
|
||||
private:
|
||||
webkit::ppapi::PluginInstance* plugin_;
|
||||
scoped_refptr<webkit::ppapi::PluginInstance> plugin_;
|
||||
RenderWidgetFullscreenPepper* widget_;
|
||||
WebSize size_;
|
||||
WebCursorInfo cursor_;
|
||||
@ -223,7 +213,7 @@ void RenderWidgetFullscreenPepper::Close() {
|
||||
// If the fullscreen window is closed (e.g. user pressed escape), reset to
|
||||
// normal mode.
|
||||
if (plugin_)
|
||||
plugin_->SetFullscreen(false);
|
||||
plugin_->SetFullscreen(false, false);
|
||||
}
|
||||
|
||||
webkit::ppapi::PluginInstance*
|
||||
|
@ -7,9 +7,10 @@
|
||||
|
||||
#include "ppapi/c/pp_bool.h"
|
||||
#include "ppapi/c/pp_instance.h"
|
||||
#include "ppapi/c/pp_size.h"
|
||||
#include "ppapi/c/pp_stdint.h"
|
||||
|
||||
#define PPB_FULLSCREEN_DEV_INTERFACE "PPB_Fullscreen(Dev);0.3"
|
||||
#define PPB_FULLSCREEN_DEV_INTERFACE "PPB_Fullscreen(Dev);0.4"
|
||||
|
||||
// Use this interface to change a plugin instance to fullscreen mode.
|
||||
struct PPB_Fullscreen_Dev {
|
||||
@ -18,11 +19,19 @@ struct PPB_Fullscreen_Dev {
|
||||
|
||||
// Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on
|
||||
// success, PP_FALSE on failure.
|
||||
// When in fullscreen mode, the plugin will be transparently scaled to the
|
||||
// size of the screen. It will not receive a ViewChanged event, and doesn't
|
||||
// need to rebind the graphics context. The pending flushes will execute
|
||||
// normally, to the new fullscreen window.
|
||||
// This unbinds the current Graphics2D or Surface3D. Pending flushes and
|
||||
// swapbuffers will execute as if the resource was off-screen. The transition
|
||||
// is asynchronous. During the transition, IsFullscreen will return PP_False,
|
||||
// and no Graphics2D or Surface3D can be bound. The transition ends at the
|
||||
// next DidChangeView.
|
||||
// Note: when switching to and from fullscreen, Context3D and Surface3D
|
||||
// resources need to be re-created. This is a current limitation that will be
|
||||
// lifted in a later revision.
|
||||
PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen);
|
||||
|
||||
// Gets the size of the screen. When going fullscreen, the instance will be
|
||||
// resized to that size.
|
||||
PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size);
|
||||
};
|
||||
|
||||
#endif /* PPAPI_C_DEV_PPB_FULLSCREEN_DEV_H_ */
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "ppapi/cpp/instance.h"
|
||||
#include "ppapi/cpp/module.h"
|
||||
#include "ppapi/cpp/module_impl.h"
|
||||
#include "ppapi/cpp/size.h"
|
||||
|
||||
namespace pp {
|
||||
|
||||
@ -21,7 +22,7 @@ template <> const char* interface_name<PPB_Fullscreen_Dev>() {
|
||||
} // namespace
|
||||
|
||||
Fullscreen_Dev::Fullscreen_Dev(Instance* instance)
|
||||
: associated_instance_(instance) {
|
||||
: instance_(instance) {
|
||||
}
|
||||
|
||||
Fullscreen_Dev::~Fullscreen_Dev() {
|
||||
@ -30,14 +31,21 @@ Fullscreen_Dev::~Fullscreen_Dev() {
|
||||
bool Fullscreen_Dev::IsFullscreen() {
|
||||
return has_interface<PPB_Fullscreen_Dev>() &&
|
||||
get_interface<PPB_Fullscreen_Dev>()->IsFullscreen(
|
||||
associated_instance_->pp_instance());
|
||||
instance_->pp_instance());
|
||||
}
|
||||
|
||||
bool Fullscreen_Dev::SetFullscreen(bool fullscreen) {
|
||||
if (!has_interface<PPB_Fullscreen_Dev>())
|
||||
return false;
|
||||
return PPBoolToBool(get_interface<PPB_Fullscreen_Dev>()->SetFullscreen(
|
||||
associated_instance_->pp_instance(), BoolToPPBool(fullscreen)));
|
||||
instance_->pp_instance(), BoolToPPBool(fullscreen)));
|
||||
}
|
||||
|
||||
bool Fullscreen_Dev::GetScreenSize(Size* size) {
|
||||
if (!has_interface<PPB_Fullscreen_Dev>())
|
||||
return false;
|
||||
return PPBoolToBool(get_interface<PPB_Fullscreen_Dev>()->GetScreenSize(
|
||||
instance_->pp_instance(), &size->pp_size()));
|
||||
}
|
||||
|
||||
} // namespace pp
|
||||
|
@ -5,13 +5,10 @@
|
||||
#ifndef PPAPI_CPP_DEV_FULLSCREEN_DEV_H_
|
||||
#define PPAPI_CPP_DEV_FULLSCREEN_DEV_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
|
||||
|
||||
namespace pp {
|
||||
|
||||
class Instance;
|
||||
class Size;
|
||||
|
||||
class Fullscreen_Dev {
|
||||
public:
|
||||
@ -21,9 +18,10 @@ class Fullscreen_Dev {
|
||||
// PPB_Fullscreen_Dev methods.
|
||||
bool IsFullscreen();
|
||||
bool SetFullscreen(bool fullscreen);
|
||||
bool GetScreenSize(Size* size);
|
||||
|
||||
private:
|
||||
Instance* associated_instance_;
|
||||
Instance* instance_;
|
||||
};
|
||||
|
||||
} // namespace pp
|
||||
|
@ -456,6 +456,10 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFullscreen_SetFullscreen,
|
||||
PP_Instance /* instance */,
|
||||
PP_Bool /* fullscreen */,
|
||||
PP_Bool /* result */)
|
||||
IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBFullscreen_GetScreenSize,
|
||||
PP_Instance /* instance */,
|
||||
PP_Bool /* result */,
|
||||
PP_Size /* size */)
|
||||
|
||||
// PPB_Graphics2D.
|
||||
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create,
|
||||
|
@ -35,9 +35,21 @@ PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
|
||||
return result;
|
||||
}
|
||||
|
||||
PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
|
||||
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
|
||||
if (!dispatcher)
|
||||
return PP_FALSE;
|
||||
|
||||
PP_Bool result = PP_FALSE;
|
||||
dispatcher->Send(new PpapiHostMsg_PPBFullscreen_GetScreenSize(
|
||||
INTERFACE_ID_PPB_FULLSCREEN, instance, &result, size));
|
||||
return result;
|
||||
}
|
||||
|
||||
const PPB_Fullscreen_Dev fullscreen_interface = {
|
||||
&IsFullscreen,
|
||||
&SetFullscreen
|
||||
&SetFullscreen,
|
||||
&GetScreenSize
|
||||
};
|
||||
|
||||
InterfaceProxy* CreateFullscreenProxy(Dispatcher* dispatcher,
|
||||
@ -74,6 +86,8 @@ bool PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) {
|
||||
OnMsgIsFullscreen)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_SetFullscreen,
|
||||
OnMsgSetFullscreen)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_GetScreenSize,
|
||||
OnMsgGetScreenSize)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
// TODO(brettw): handle bad messages!
|
||||
@ -91,5 +105,11 @@ void PPB_Fullscreen_Proxy::OnMsgSetFullscreen(PP_Instance instance,
|
||||
*result = ppb_fullscreen_target()->SetFullscreen(instance, fullscreen);
|
||||
}
|
||||
|
||||
void PPB_Fullscreen_Proxy::OnMsgGetScreenSize(PP_Instance instance,
|
||||
PP_Bool* result,
|
||||
PP_Size* size) {
|
||||
*result = ppb_fullscreen_target()->GetScreenSize(instance, size);
|
||||
}
|
||||
|
||||
} // namespace proxy
|
||||
} // namespace pp
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "ppapi/c/pp_completion_callback.h"
|
||||
#include "ppapi/c/pp_bool.h"
|
||||
#include "ppapi/c/pp_size.h"
|
||||
#include "ppapi/c/pp_instance.h"
|
||||
#include "ppapi/proxy/interface_proxy.h"
|
||||
|
||||
@ -36,6 +37,9 @@ class PPB_Fullscreen_Proxy : public InterfaceProxy {
|
||||
void OnMsgSetFullscreen(PP_Instance instance,
|
||||
PP_Bool fullscreen,
|
||||
PP_Bool* result);
|
||||
void OnMsgGetScreenSize(PP_Instance instance,
|
||||
PP_Bool* result,
|
||||
PP_Size* size);
|
||||
};
|
||||
|
||||
} // namespace proxy
|
||||
|
@ -178,6 +178,10 @@ FullscreenContainer* MockPluginDelegate::CreateFullscreenContainer(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gfx::Size MockPluginDelegate::GetScreenSize() {
|
||||
return gfx::Size(1024, 768);
|
||||
}
|
||||
|
||||
std::string MockPluginDelegate::GetDefaultEncoding() {
|
||||
return "iso-8859-1";
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ class MockPluginDelegate : public PluginDelegate {
|
||||
const gfx::Point& position);
|
||||
virtual FullscreenContainer* CreateFullscreenContainer(
|
||||
PluginInstance* instance);
|
||||
virtual gfx::Size GetScreenSize();
|
||||
virtual std::string GetDefaultEncoding();
|
||||
virtual void ZoomLimitsChanged(double minimum_factor,
|
||||
double maximum_factor);
|
||||
|
@ -308,6 +308,10 @@ class PluginDelegate {
|
||||
virtual FullscreenContainer* CreateFullscreenContainer(
|
||||
PluginInstance* instance) = 0;
|
||||
|
||||
// Gets the size of the screen. The fullscreen window will be created at that
|
||||
// size.
|
||||
virtual gfx::Size GetScreenSize() = 0;
|
||||
|
||||
// Returns a string with the name of the default 8-bit char encoding.
|
||||
virtual std::string GetDefaultEncoding() = 0;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
@ -247,12 +248,24 @@ PP_Bool SetFullscreen(PP_Instance instance_id, PP_Bool fullscreen) {
|
||||
PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
|
||||
if (!instance)
|
||||
return PP_FALSE;
|
||||
return BoolToPPBool(instance->SetFullscreen(PPBoolToBool(fullscreen)));
|
||||
instance->SetFullscreen(PPBoolToBool(fullscreen), true);
|
||||
return PP_TRUE;
|
||||
}
|
||||
|
||||
PP_Bool GetScreenSize(PP_Instance instance_id, PP_Size* size) {
|
||||
PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
|
||||
if (!instance || !size)
|
||||
return PP_FALSE;
|
||||
gfx::Size screen_size = instance->delegate()->GetScreenSize();
|
||||
*size = PP_MakeSize(screen_size.width(), screen_size.height());
|
||||
return PP_TRUE;
|
||||
}
|
||||
|
||||
|
||||
const PPB_Fullscreen_Dev ppb_fullscreen = {
|
||||
&IsFullscreen,
|
||||
&SetFullscreen,
|
||||
&GetScreenSize
|
||||
};
|
||||
|
||||
void ZoomChanged(PP_Instance instance_id, double factor) {
|
||||
@ -321,7 +334,8 @@ PluginInstance::PluginInstance(PluginDelegate* delegate,
|
||||
plugin_print_interface_(NULL),
|
||||
plugin_graphics_3d_interface_(NULL),
|
||||
always_on_top_(false),
|
||||
fullscreen_container_(NULL) {
|
||||
fullscreen_container_(NULL),
|
||||
fullscreen_(false) {
|
||||
pp_instance_ = ResourceTracker::Get()->AddInstance(this);
|
||||
|
||||
memset(¤t_print_settings_, 0, sizeof(current_print_settings_));
|
||||
@ -433,7 +447,7 @@ void PluginInstance::InstanceCrashed() {
|
||||
ResourceTracker::Get()->InstanceCrashed(pp_instance());
|
||||
|
||||
// Free any associated graphics.
|
||||
SetFullscreen(false);
|
||||
SetFullscreen(false, false);
|
||||
bound_graphics_ = NULL;
|
||||
InvalidateRect(gfx::Rect());
|
||||
|
||||
@ -479,6 +493,9 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
|
||||
Resource::GetAs<PPB_Surface3D_Impl>(graphics_id);
|
||||
|
||||
if (graphics_2d) {
|
||||
// Refuse to bind if we're transitioning to fullscreen.
|
||||
if (fullscreen_container_ && !fullscreen_)
|
||||
return false;
|
||||
if (!graphics_2d->BindToInstance(this))
|
||||
return false; // Can't bind to more than one instance.
|
||||
|
||||
@ -508,6 +525,9 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
|
||||
bound_graphics_ = graphics_2d;
|
||||
// BindToInstance will have invalidated the plugin if necessary.
|
||||
} else if (graphics_3d) {
|
||||
// Refuse to bind if we're transitioning to fullscreen.
|
||||
if (fullscreen_container_ && !fullscreen_)
|
||||
return false;
|
||||
// Make sure graphics can only be bound to the instance it is
|
||||
// associated with.
|
||||
if (graphics_3d->instance() != this)
|
||||
@ -635,6 +655,7 @@ PP_Var PluginInstance::GetInstanceObject() {
|
||||
|
||||
void PluginInstance::ViewChanged(const gfx::Rect& position,
|
||||
const gfx::Rect& clip) {
|
||||
fullscreen_ = (fullscreen_container_ != NULL);
|
||||
position_ = position;
|
||||
|
||||
if (clip.IsEmpty()) {
|
||||
@ -838,6 +859,14 @@ bool PluginInstance::PluginHasFocus() const {
|
||||
return has_webkit_focus_ && has_content_area_focus_;
|
||||
}
|
||||
|
||||
void PluginInstance::ReportGeometry() {
|
||||
// If this call was delayed, we may have transitioned back to fullscreen in
|
||||
// the mean time, so only report the geometry if we are actually in normal
|
||||
// mode.
|
||||
if (container_ && !fullscreen_container_)
|
||||
container_->reportGeometry();
|
||||
}
|
||||
|
||||
bool PluginInstance::GetPreferredPrintOutputFormat(
|
||||
PP_PrintOutputFormat_Dev* format) {
|
||||
// Keep a reference on the stack. See NOTE above.
|
||||
@ -966,30 +995,40 @@ void PluginInstance::PrintEnd() {
|
||||
}
|
||||
|
||||
bool PluginInstance::IsFullscreen() {
|
||||
return fullscreen_;
|
||||
}
|
||||
|
||||
bool PluginInstance::IsFullscreenOrPending() {
|
||||
return fullscreen_container_ != NULL;
|
||||
}
|
||||
|
||||
bool PluginInstance::SetFullscreen(bool fullscreen) {
|
||||
void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) {
|
||||
// Keep a reference on the stack. See NOTE above.
|
||||
scoped_refptr<PluginInstance> ref(this);
|
||||
bool is_fullscreen = (fullscreen_container_ != NULL);
|
||||
if (fullscreen == is_fullscreen)
|
||||
return true;
|
||||
|
||||
// We check whether we are trying to switch to the state we're already going
|
||||
// to (i.e. if we're already switching to fullscreen but the fullscreen
|
||||
// container isn't ready yet, don't do anything more).
|
||||
if (fullscreen == IsFullscreenOrPending())
|
||||
return;
|
||||
|
||||
BindGraphics(0);
|
||||
VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
|
||||
if (fullscreen) {
|
||||
DCHECK(!fullscreen_container_);
|
||||
fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
|
||||
} else {
|
||||
DCHECK(fullscreen_container_);
|
||||
fullscreen_container_->Destroy();
|
||||
fullscreen_container_ = NULL;
|
||||
// TODO(piman): currently the fullscreen container resizes the plugin to the
|
||||
// fullscreen size so we need to reset the size here. Eventually it will
|
||||
// transparently scale and this won't be necessary.
|
||||
if (container_) {
|
||||
container_->reportGeometry();
|
||||
container_->invalidate();
|
||||
fullscreen_ = false;
|
||||
if (!delay_report) {
|
||||
ReportGeometry();
|
||||
} else {
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PluginInstance::NavigateToURL(const char* url, const char* target) {
|
||||
|
@ -186,8 +186,26 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
|
||||
void Graphics3DContextLost();
|
||||
|
||||
// Implementation of PPB_Fullscreen_Dev.
|
||||
|
||||
// Because going to fullscreen is asynchronous (but going out is not), there
|
||||
// are 3 states:
|
||||
// - normal (fullscreen_container_ == NULL)
|
||||
// - fullscreen pending (fullscreen_container_ != NULL, fullscreen_ == false)
|
||||
// - fullscreen (fullscreen_container_ != NULL, fullscreen_ = true)
|
||||
//
|
||||
// In normal state, events come from webkit and painting goes back to it.
|
||||
// In fullscreen state, events come from the fullscreen container, and
|
||||
// painting goes back to it
|
||||
// In pending state, events from webkit are ignored, and as soon as we receive
|
||||
// events from the fullscreen container, we go to the fullscreen state.
|
||||
bool IsFullscreen();
|
||||
bool SetFullscreen(bool fullscreen);
|
||||
bool IsFullscreenOrPending();
|
||||
|
||||
// Switches between fullscreen and normal mode. If |delay_report| is set to
|
||||
// false, it may report the new state through DidChangeView immediately. If
|
||||
// true, it will delay it. When called from the plugin, delay_report should be
|
||||
// true to avoid re-entrancy.
|
||||
void SetFullscreen(bool fullscreen, bool delay_report);
|
||||
|
||||
// Implementation of PPB_Flash.
|
||||
bool NavigateToURL(const char* url, const char* target);
|
||||
@ -220,6 +238,10 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
|
||||
// (see has_webkit_focus_ below).
|
||||
bool PluginHasFocus() const;
|
||||
|
||||
// Reports the current plugin geometry to the plugin by calling
|
||||
// DidChangeView.
|
||||
void ReportGeometry();
|
||||
|
||||
// Queries the plugin for supported print formats and sets |format| to the
|
||||
// best format to use. Returns false if the plugin does not support any
|
||||
// print format that we can handle (we can handle raster and PDF).
|
||||
@ -328,9 +350,14 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
|
||||
// to use a more optimized painting path in some cases.
|
||||
bool always_on_top_;
|
||||
|
||||
// Plugin container for fullscreen mode. NULL if not in fullscreen mode.
|
||||
// Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note:
|
||||
// there is a transition state where fullscreen_container_ is non-NULL but
|
||||
// fullscreen_ is false (see above).
|
||||
FullscreenContainer* fullscreen_container_;
|
||||
|
||||
// True if we are in fullscreen mode. Note: it is false during the transition.
|
||||
bool fullscreen_;
|
||||
|
||||
typedef std::set<PluginObject*> PluginObjectSet;
|
||||
PluginObjectSet live_plugin_objects_;
|
||||
|
||||
|
@ -96,7 +96,7 @@ NPObject* WebPluginImpl::scriptableObject() {
|
||||
}
|
||||
|
||||
void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) {
|
||||
if (!instance_->IsFullscreen())
|
||||
if (!instance_->IsFullscreenOrPending())
|
||||
instance_->Paint(canvas, plugin_rect_, rect);
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ void WebPluginImpl::updateGeometry(
|
||||
const WebVector<WebRect>& cut_outs_rects,
|
||||
bool is_visible) {
|
||||
plugin_rect_ = window_rect;
|
||||
if (!instance_->IsFullscreen())
|
||||
if (!instance_->IsFullscreenOrPending())
|
||||
instance_->ViewChanged(plugin_rect_, clip_rect);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ bool WebPluginImpl::acceptsInputEvents() {
|
||||
|
||||
bool WebPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event,
|
||||
WebKit::WebCursorInfo& cursor_info) {
|
||||
if (instance_->IsFullscreen())
|
||||
if (instance_->IsFullscreenOrPending())
|
||||
return false;
|
||||
return instance_->HandleInputEvent(event, &cursor_info);
|
||||
}
|
||||
|
@ -459,12 +459,14 @@ bool PPB_Graphics2D_Impl::BindToInstance(PluginInstance* new_instance) {
|
||||
// we need to clear the list, but we still want to issue any pending
|
||||
// callbacks to the plugin.
|
||||
if (!unpainted_flush_callback_.is_null()) {
|
||||
ScheduleOffscreenCallback(unpainted_flush_callback_);
|
||||
unpainted_flush_callback_.Clear();
|
||||
FlushCallbackData callback;
|
||||
std::swap(callback, unpainted_flush_callback_);
|
||||
ScheduleOffscreenCallback(callback);
|
||||
}
|
||||
if (!painted_flush_callback_.is_null()) {
|
||||
ScheduleOffscreenCallback(painted_flush_callback_);
|
||||
painted_flush_callback_.Clear();
|
||||
FlushCallbackData callback;
|
||||
std::swap(callback, painted_flush_callback_);
|
||||
ScheduleOffscreenCallback(callback);
|
||||
}
|
||||
} else if (flushed_any_data_) {
|
||||
// Only schedule a paint if this backing store has had any data flushed to
|
||||
|
@ -144,9 +144,6 @@ int32_t PPB_Surface3D_Impl::SwapBuffers(PP_CompletionCallback callback) {
|
||||
}
|
||||
|
||||
void PPB_Surface3D_Impl::ViewInitiatedPaint() {
|
||||
if (swap_callback_.func) {
|
||||
swap_initiated_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void PPB_Surface3D_Impl::ViewFlushedPaint() {
|
||||
@ -166,8 +163,17 @@ unsigned int PPB_Surface3D_Impl::GetBackingTextureId() {
|
||||
}
|
||||
|
||||
void PPB_Surface3D_Impl::OnSwapBuffers() {
|
||||
if (bound_to_instance_)
|
||||
if (bound_to_instance_) {
|
||||
instance()->CommitBackingTexture();
|
||||
swap_initiated_ = true;
|
||||
} else if (swap_callback_.func) {
|
||||
// If we're off-screen, no need to trigger compositing so run the callback
|
||||
// immediately.
|
||||
PP_CompletionCallback callback = PP_BlockUntilComplete();
|
||||
std::swap(callback, swap_callback_);
|
||||
swap_initiated_ = false;
|
||||
PP_RunCompletionCallback(&callback, PP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ppapi
|
||||
|
Reference in New Issue
Block a user