Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 95693002: <webview>: Expose transparency API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 192f64c76d261a81d50df4d6b3e540989c1ca68e..178f96d70aef03dedef3df2c3b25caf5bc839201 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -86,7 +86,6 @@ BrowserPlugin::BrowserPlugin(
content_window_routing_id_(MSG_ROUTING_NONE),
plugin_focused_(false),
visible_(true),
- opaque_(true),
before_first_navigation_(true),
mouse_locked_(false),
browser_plugin_manager_(render_view->GetBrowserPluginManager()),
@@ -182,6 +181,10 @@ std::string BrowserPlugin::GetNameAttribute() const {
return GetDOMAttributeValue(browser_plugin::kAttributeName);
}
+bool BrowserPlugin::GetAllowTransparencyAttribute() const {
+ return HasDOMAttribute(browser_plugin::kAttributeAllowTransparency);
+}
+
std::string BrowserPlugin::GetSrcAttribute() const {
return GetDOMAttributeValue(browser_plugin::kAttributeSrc);
}
@@ -259,6 +262,21 @@ void BrowserPlugin::ParseNameAttribute() {
GetNameAttribute()));
}
+void BrowserPlugin::ParseAllowTransparencyAttribute() {
+ if (!HasGuestInstanceID())
+ return;
+
+ bool opaque = !GetAllowTransparencyAttribute();
+
+ if (compositing_helper_)
+ compositing_helper_->SetContentsOpaque(opaque);
+
+ browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetContentsOpaque(
+ render_view_routing_id_,
+ guest_instance_id_,
+ opaque));
+}
+
bool BrowserPlugin::ParseSrcAttribute(std::string* error_message) {
if (!valid_partition_id_) {
*error_message = browser_plugin::kErrorInvalidPartition;
@@ -372,7 +390,7 @@ void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) {
BrowserPluginHostMsg_Attach_Params attach_params;
attach_params.focused = ShouldGuestBeFocused();
attach_params.visible = visible_;
- attach_params.opaque = opaque_;
+ attach_params.opaque = !GetAllowTransparencyAttribute();
attach_params.name = GetNameAttribute();
attach_params.storage_partition_id = storage_partition_id_;
attach_params.persist_storage = persist_storage_;
@@ -393,23 +411,6 @@ void BrowserPlugin::DidCommitCompositorFrame() {
compositing_helper_->DidCommitCompositorFrame();
}
-void BrowserPlugin::SetContentsOpaque(bool opaque) {
- if (opaque_ == opaque)
- return;
-
- opaque_ = opaque;
- if (!HasGuestInstanceID())
- return;
-
- if (compositing_helper_)
- compositing_helper_->SetContentsOpaque(opaque_);
-
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetContentsOpaque(
- render_view_routing_id_,
- guest_instance_id_,
- opaque_));
-}
-
void BrowserPlugin::OnAdvanceFocus(int guest_instance_id, bool reverse) {
DCHECK(render_view_.get());
render_view_->GetWebView()->advanceFocus(reverse);
@@ -922,7 +923,7 @@ void BrowserPlugin::EnableCompositing(bool enable) {
}
}
compositing_helper_->EnableCompositing(enable);
- compositing_helper_->SetContentsOpaque(opaque_);
+ compositing_helper_->SetContentsOpaque(!GetAllowTransparencyAttribute());
}
void BrowserPlugin::destroy() {
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | content/renderer/browser_plugin/browser_plugin_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698