diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 17:43:36 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 17:43:36 +0000 |
commit | e8f07ac77c1b27633eb7c6c2793d5b465e023f9f (patch) | |
tree | 6b1aa7de84dcb5f18adac114bba01c4f77a71e6b /ppapi/native_client/src/trusted/plugin | |
parent | 08d9dfe8c279ec894cdacdf5f0a89bd8c85a92fc (diff) | |
download | chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.zip chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.gz chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.bz2 |
Change the DidChangeView update to take a new ViewChanged resource.
This will allow us to be more flexible about adding data to view changed updates in the future. For now, I've incorporated fullscreen and tab foreground state into the view state.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8951014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client/src/trusted/plugin')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.cc | 36 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.h | 16 |
2 files changed, 21 insertions, 31 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index d00dca4..9cdbd7c 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -1001,8 +1001,6 @@ Plugin::Plugin(PP_Instance pp_instance) last_error_string_(""), ppapi_proxy_(NULL), enable_dev_interfaces_(false), - replayDidChangeView(false), - replayHandleDocumentLoad(false), init_time_(0), ready_time_(0), nexe_size_(0), @@ -1080,19 +1078,16 @@ Plugin::~Plugin() { } -void Plugin::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { +void Plugin::DidChangeView(const pp::View& view) { PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n", static_cast<void*>(this))); if (!BrowserPpp::is_valid(ppapi_proxy_)) { // Store this event and replay it when the proxy becomes available. - replayDidChangeView = true; - replayDidChangeViewPosition = position; - replayDidChangeViewClip = clip; - return; + view_to_replay_ = view; } else { ppapi_proxy_->ppp_instance_interface()->DidChangeView( - pp_instance(), &(position.pp_rect()), &(clip.pp_rect())); + pp_instance(), view.pp_resource()); } } @@ -1100,9 +1095,7 @@ void Plugin::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { void Plugin::DidChangeFocus(bool has_focus) { PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n", static_cast<void*>(this))); - if (!BrowserPpp::is_valid(ppapi_proxy_)) { - return; - } else { + if (BrowserPpp::is_valid(ppapi_proxy_)) { ppapi_proxy_->ppp_instance_interface()->DidChangeFocus( pp_instance(), PP_FromBool(has_focus)); } @@ -1130,8 +1123,7 @@ bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) { static_cast<void*>(this))); if (!BrowserPpp::is_valid(ppapi_proxy_)) { // Store this event and replay it when the proxy becomes available. - replayHandleDocumentLoad = true; - replayHandleDocumentLoadURLLoader = url_loader; + document_load_to_replay_ = url_loader; // Return true so that the browser keeps servicing this loader so we can // perform requests on it later. return true; @@ -1384,7 +1376,7 @@ bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel, CHECK(module != NULL); // We could not have gotten past init stage otherwise. int32_t pp_error = ppapi_proxy->InitializeModule(module->pp_module(), - module->get_browser_interface()); + module->get_browser_interface()); PLUGIN_PRINTF(("Plugin::StartProxiedExecution (pp_error=%" NACL_PRId32")\n", pp_error)); if (pp_error != PP_OK) { @@ -1421,15 +1413,13 @@ bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel, zoom_adapter_.reset(new(std::nothrow) ZoomAdapter(this)); // Replay missed events. - if (replayDidChangeView) { - replayDidChangeView = false; - DidChangeView(replayDidChangeViewPosition, replayDidChangeViewClip); - } - if (replayHandleDocumentLoad) { - replayHandleDocumentLoad = false; - HandleDocumentLoad(replayHandleDocumentLoadURLLoader); - // Release our reference on this loader. - replayHandleDocumentLoadURLLoader = pp::URLLoader(); + if (!view_to_replay_.is_null()) { + DidChangeView(view_to_replay_); + view_to_replay_ = pp::View(); + } + if (!document_load_to_replay_.is_null()) { + HandleDocumentLoad(document_load_to_replay_); + document_load_to_replay_ = pp::URLLoader(); } bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_); PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n", diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 4836312..94a1307 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -33,6 +33,7 @@ #include "ppapi/cpp/rect.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/view.h" struct NaClSrpcChannel; @@ -84,7 +85,7 @@ class Plugin : public pp::InstancePrivate { virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); // Handles view changes from the browser. - virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip); + virtual void DidChangeView(const pp::View& view); // Handles gaining or losing focus. virtual void DidChangeFocus(bool has_focus); @@ -519,15 +520,14 @@ class Plugin : public pp::InstancePrivate { bool enable_dev_interfaces_; // If we get a DidChangeView event before the nexe is loaded, we store it and - // replay it to nexe after it's loaded. - bool replayDidChangeView; - pp::Rect replayDidChangeViewPosition; - pp::Rect replayDidChangeViewClip; + // replay it to nexe after it's loaded. We need to replay when this View + // resource is non-is_null(). + pp::View view_to_replay_; // If we get a HandleDocumentLoad event before the nexe is loaded, we store - // it and replay it to nexe after it's loaded. - bool replayHandleDocumentLoad; - pp::URLLoader replayHandleDocumentLoadURLLoader; + // it and replay it to nexe after it's loaded. We need to replay when this + // URLLoader resource is non-is_null(). + pp::URLLoader document_load_to_replay_; nacl::string mime_type_; |