diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:07:43 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:07:43 +0000 |
commit | 7386e387a1de3390ef4454c39b6826ac812a57c0 (patch) | |
tree | f3328da78ccf76eba874468a0d312f6c7675c301 | |
parent | 93021c600f052d9bd3162cf652ee9c7a7e642dc5 (diff) | |
download | chromium_src-7386e387a1de3390ef4454c39b6826ac812a57c0.zip chromium_src-7386e387a1de3390ef4454c39b6826ac812a57c0.tar.gz chromium_src-7386e387a1de3390ef4454c39b6826ac812a57c0.tar.bz2 |
Add hide icon on the click-to-play UI too.
BUG=63695
TEST=see bug
Review URL: http://codereview.chromium.org/6354025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72699 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/blocked_plugin.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/blocked_plugin.h | 1 | ||||
-rw-r--r-- | chrome/renderer/resources/click_to_play_plugin.html | 20 |
3 files changed, 27 insertions, 2 deletions
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc index 229f08f..20bfd30 100644 --- a/chrome/renderer/blocked_plugin.cc +++ b/chrome/renderer/blocked_plugin.cc @@ -60,7 +60,8 @@ BlockedPlugin::BlockedPlugin(RenderView* render_view, : RenderViewObserver(render_view), frame_(frame), plugin_params_(params), - is_blocked_for_prerendering_(is_blocked_for_prerendering) { + is_blocked_for_prerendering_(is_blocked_for_prerendering), + hidden_(false) { const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); @@ -156,6 +157,10 @@ void BlockedPlugin::OnMenuItemSelected(unsigned id) { void BlockedPlugin::LoadPlugin() { CHECK(plugin_); + // This is not strictly necessary but is an important defense in case the + // event propagation changes between "close" vs. "click-to-play". + if (hidden_) + return; WebPluginContainer* container = plugin_->container(); WebPlugin* new_plugin = render_view()->CreatePluginNoCheck(frame_, plugin_params_); @@ -178,6 +183,7 @@ void BlockedPlugin::Hide(const CppArgumentList& args, CppVariant* result) { void BlockedPlugin::HidePlugin() { CHECK(plugin_); + hidden_ = true; WebPluginContainer* container = plugin_->container(); WebElement element = container->element(); element.setAttribute("style", "display: none;"); diff --git a/chrome/renderer/blocked_plugin.h b/chrome/renderer/blocked_plugin.h index 40916e9..44e6699 100644 --- a/chrome/renderer/blocked_plugin.h +++ b/chrome/renderer/blocked_plugin.h @@ -70,6 +70,7 @@ class BlockedPlugin : public RenderViewObserver, // True iff the plugin was blocked because the page was being prerendered. // Plugin will automatically be loaded when the page is displayed. bool is_blocked_for_prerendering_; + bool hidden_; }; #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ diff --git a/chrome/renderer/resources/click_to_play_plugin.html b/chrome/renderer/resources/click_to_play_plugin.html index cd878f1..e2b664d 100644 --- a/chrome/renderer/resources/click_to_play_plugin.html +++ b/chrome/renderer/resources/click_to_play_plugin.html @@ -30,7 +30,7 @@ h1 { visibility: hidden; } -#outer:hover h1 { +#outer:hover h1, #outer:hover img { visibility: visible; } @@ -68,6 +68,14 @@ FIXME: This causes flickering on hover. top: 50%; margin-top: -70px; } + +#close { + visibility: hidden; + cursor: pointer; + position: absolute; + right: 0px; + top: 0px; +} </style> </head> @@ -78,6 +86,16 @@ FIXME: This causes flickering on hover. <h1 i18n-content="message">PLUGIN_LOAD</h1> <p id="debug"> </p> </div> +<img id="close" onclick="event.stopPropagation(); plugin.hide()" + src="../../app/theme/close_bar_h.png"> </div> +<script> +size = document.getElementById('outer'); +style = getComputedStyle(size); +if (parseInt(style.width) < 32 && parseInt(style.height) < 32) { + i = document.getElementById('close'); + i.parentNode.removeChild(i); +} +</script> </body> </html> |