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

Unified Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 1065413002: <webview>: Don't reset allowtransparency and allowscaling between createGuest and attachGuest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/guest_view/web_view/web_view_guest.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index 34c4a15d2bb9930e761965756b30f3f28c0458b7..d0790d874ffd86b45d4d70437a8d53a8659bd005 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -422,14 +422,14 @@ void WebViewGuest::GuestReady() {
// WebContents::GetRenderWidgetHostView will return the RWHV of an
// interstitial page if one is showing at this time. We only want opacity
// to apply to web pages.
- if (guest_opaque_) {
+ if (allow_transparency_) {
+ web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
+ SK_ColorTRANSPARENT);
+ } else {
web_contents()
->GetRenderViewHost()
->GetView()
->SetBackgroundColorToDefault();
- } else {
- web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
- SK_ColorTRANSPARENT);
}
}
@@ -721,7 +721,7 @@ WebViewGuest::WebViewGuest(content::WebContents* owner_web_contents)
rules_registry_id_(RulesRegistryService::kInvalidRulesRegistryID),
find_helper_(this),
is_overriding_user_agent_(false),
- guest_opaque_(true),
+ allow_transparency_(false),
javascript_dialog_helper_(this),
allow_scaling_(false),
is_guest_fullscreen_(false),
@@ -1018,14 +1018,16 @@ void WebViewGuest::ApplyAttributes(const base::DictionaryValue& params) {
SetUserAgentOverride(user_agent_override);
bool allow_transparency = false;
- params.GetBoolean(webview::kAttributeAllowTransparency, &allow_transparency);
- // We need to set the background opaque flag after navigation to ensure that
- // there is a RenderWidgetHostView available.
- SetAllowTransparency(allow_transparency);
+ if (params.GetBoolean(webview::kAttributeAllowTransparency,
+ &allow_transparency)) {
+ // We need to set the background opaque flag after navigation to ensure that
+ // there is a RenderWidgetHostView available.
+ SetAllowTransparency(allow_transparency);
+ }
bool allow_scaling = false;
- params.GetBoolean(webview::kAttributeAllowScaling, &allow_scaling);
- SetAllowScaling(allow_scaling);
+ if (params.GetBoolean(webview::kAttributeAllowScaling, &allow_scaling))
+ SetAllowScaling(allow_scaling);
bool is_pending_new_window = false;
if (GetOpener()) {
@@ -1082,21 +1084,21 @@ void WebViewGuest::SetZoomMode(ZoomController::ZoomMode zoom_mode) {
}
void WebViewGuest::SetAllowTransparency(bool allow) {
- if (guest_opaque_ != allow)
+ if (allow_transparency_ == allow)
return;
- guest_opaque_ = !allow;
+ allow_transparency_ = allow;
if (!web_contents()->GetRenderViewHost()->GetView())
return;
- if (guest_opaque_) {
+ if (allow_transparency_) {
+ web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
+ SK_ColorTRANSPARENT);
+ } else {
web_contents()
->GetRenderViewHost()
->GetView()
->SetBackgroundColorToDefault();
- } else {
- web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
- SK_ColorTRANSPARENT);
}
}
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698