diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-05 07:49:19 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-05 07:49:19 +0000 |
commit | 39834d692a6f7eab24b30a83327da45baa949bd8 (patch) | |
tree | af05fb6e44dd17bf208bc1f3fe6e67c53227f9c9 /webkit/glue/plugins | |
parent | 4505058da821358795cb6947f133807414e4e5eb (diff) | |
download | chromium_src-39834d692a6f7eab24b30a83327da45baa949bd8.zip chromium_src-39834d692a6f7eab24b30a83327da45baa949bd8.tar.gz chromium_src-39834d692a6f7eab24b30a83327da45baa949bd8.tar.bz2 |
Fix Flash window in Analytics being incorrectly visible.
The bug was that we accidentally marked a plugin widget as visible if it's parent was visible, even if it was explicitly set as hidden.
BUG=8927
TEST=regression test included, also can verify that analytics doesn't display the gray rectangle per the bug
Review URL: http://codereview.chromium.org/106008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/test/npapi_test_plugin.vcproj | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_client.cc | 7 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_test.h | 1 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_windowed_test.cc | 38 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_windowed_test.h | 22 |
5 files changed, 76 insertions, 0 deletions
diff --git a/webkit/glue/plugins/test/npapi_test_plugin.vcproj b/webkit/glue/plugins/test/npapi_test_plugin.vcproj index eff52e9..a8c9a3c 100644 --- a/webkit/glue/plugins/test/npapi_test_plugin.vcproj +++ b/webkit/glue/plugins/test/npapi_test_plugin.vcproj @@ -263,6 +263,14 @@ > </File> <File + RelativePath=".\plugin_windowed_test.cc" + > + </File> + <File + RelativePath=".\plugin_windowed_test.h" + > + </File> + <File RelativePath=".\plugin_windowless_test.cc" > </File> diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc index f87820e..7a92de4 100644 --- a/webkit/glue/plugins/test/plugin_client.cc +++ b/webkit/glue/plugins/test/plugin_client.cc @@ -17,6 +17,7 @@ #include "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" #include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" #include "webkit/glue/plugins/test/plugin_window_size_test.h" +#include "webkit/glue/plugins/test/plugin_windowed_test.h" #include "webkit/glue/plugins/test/plugin_windowless_test.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npruntime.h" @@ -153,6 +154,12 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, } else if (test_name == "private") { new_test = new NPAPIClient::PrivateTest(instance, NPAPIClient::PluginClient::HostFunctions()); +#if defined(OS_WIN) + // TODO(port): plugin_windowed_test.*. + } else if (test_name == "hidden_plugin") { + new_test = new NPAPIClient::WindowedPluginTest(instance, + NPAPIClient::PluginClient::HostFunctions()); +#endif } else { // If we don't have a test case for this, create a // generic one which basically never fails. diff --git a/webkit/glue/plugins/test/plugin_test.h b/webkit/glue/plugins/test/plugin_test.h index f763acc..5914fef 100644 --- a/webkit/glue/plugins/test/plugin_test.h +++ b/webkit/glue/plugins/test/plugin_test.h @@ -111,6 +111,7 @@ class PluginTest { // The NPP Identifier for this plugin instance. NPP id() { return id_; } std::string test_id() { return test_id_; } + std::string test_name() { return test_name_; } private: NPP id_; diff --git a/webkit/glue/plugins/test/plugin_windowed_test.cc b/webkit/glue/plugins/test/plugin_windowed_test.cc new file mode 100644 index 0000000..20215ef --- /dev/null +++ b/webkit/glue/plugins/test/plugin_windowed_test.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2009 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. + +#include "webkit/glue/plugins/test/plugin_windowed_test.h" +#include "webkit/glue/plugins/test/plugin_client.h" + +namespace NPAPIClient { + +WindowedPluginTest::WindowedPluginTest(NPP id, NPNetscapeFuncs *host_functions) + : PluginTest(id, host_functions) { +} + +NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) { + HWND window = reinterpret_cast<HWND>(pNPWindow->window); + if (!pNPWindow || !::IsWindow(window)) { + SetError("Invalid arguments passed in"); + return NPERR_INVALID_PARAM; + } + + if (test_name() == "hidden_plugin") { + NPIdentifier function_id; + if (IsWindowVisible(window)) { + function_id = HostFunctions()->getstringidentifier("windowVisible"); + } else { + function_id = HostFunctions()->getstringidentifier("windowHidden"); + } + + NPVariant rv; + NPObject *window_obj = NULL; + HostFunctions()->getvalue(id(), NPNVWindowNPObject, &window_obj); + HostFunctions()->invoke(id(), window_obj, function_id, NULL, 0, &rv); + } + + return NPERR_NO_ERROR; +} + +} // namespace NPAPIClient diff --git a/webkit/glue/plugins/test/plugin_windowed_test.h b/webkit/glue/plugins/test/plugin_windowed_test.h new file mode 100644 index 0000000..547b079 --- /dev/null +++ b/webkit/glue/plugins/test/plugin_windowed_test.h @@ -0,0 +1,22 @@ +// Copyright (c) 2009 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. + +#ifndef WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_WINDOWED_TEST_H +#define WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_WINDOWED_TEST_H + +#include "webkit/glue/plugins/test/plugin_test.h" + +namespace NPAPIClient { + +// This class contains a list of windowed plugin tests. Please add additional +// tests to this class. +class WindowedPluginTest : public PluginTest { + public: + WindowedPluginTest(NPP id, NPNetscapeFuncs *host_functions); + virtual NPError SetWindow(NPWindow* pNPWindow); +}; + +} // namespace NPAPIClient + +#endif // WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_WINDOWED_TEST_H |