Commit 56f93a18 authored by Santosh Mahto's avatar Santosh Mahto Committed by Santosh Mahto
Browse files

Implement transparency in browser

Fix transparency of main window.

By default, chromium doesn't assume that window can be transparent.
So changed the code to let chromium allow transparency.
parent 8fb21ef4
......@@ -35,6 +35,11 @@ void CefBrowserPlatformDelegate::RenderViewCreated(
// default view behavior in some cases (e.g. focus handling on Linux).
if (!IsViewsHosted() && render_view_host->GetWidget()->GetView())
render_view_host->GetWidget()->GetView()->SetHasExternalParent(true);
if (render_view_host->GetWidget()->GetView()) {
render_view_host->GetWidget()->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT);
}
}
void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostImpl* browser) {
......
......@@ -251,6 +251,7 @@ void CefWindowView::CreateWidget() {
params.delegate = this;
params.type = views::Widget::InitParams::TYPE_WINDOW;
params.bounds = gfx::Rect(CalculatePreferredSize());
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
bool can_activate = true;
if (cef_delegate()) {
......
......@@ -471,5 +471,9 @@ patches = [
{
# Collabora: Allow setting surface id.
'name': 'setIVISurfaceID',
},
{
# Collabora: Allow main window to be transparent.
'name': 'allow_main_window_transparency',
}
]
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
index d07f4fda0009..ec39b6358971 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -395,7 +395,11 @@ bool DesktopWindowTreeHostPlatform::ShouldUseNativeFrame() const {
}
bool DesktopWindowTreeHostPlatform::ShouldWindowContentsBeTransparent() const {
+#if 0
return false;
+#else
+ return true;
+#endif
}
void DesktopWindowTreeHostPlatform::FrameTypeChanged() {}
@@ -449,7 +453,11 @@ bool DesktopWindowTreeHostPlatform::IsTranslucentWindowOpacitySupported()
const {
// TODO: needs PlatformWindow support.
NOTIMPLEMENTED_LOG_ONCE();
+#if 0
return false;
+#else
+ return true;
+#endif
}
void DesktopWindowTreeHostPlatform::SizeConstraintsChanged() {
@@ -458,7 +466,11 @@ void DesktopWindowTreeHostPlatform::SizeConstraintsChanged() {
}
bool DesktopWindowTreeHostPlatform::ShouldUpdateWindowTransparency() const {
+#if 0
return false;
+#else
+ return true;
+#endif
}
bool DesktopWindowTreeHostPlatform::ShouldUseDesktopNativeCursorManager()
......@@ -81,6 +81,8 @@ void SimpleApp::OnContextInitialized() {
// Specify CEF browser settings here.
CefBrowserSettings browser_settings;
cef_color_t transparent = 0x00;
browser_settings.background_color = transparent;
std::string url;
......@@ -94,9 +96,11 @@ void SimpleApp::OnContextInitialized() {
// Create the BrowserView.
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
handler, url, browser_settings, NULL, NULL, NULL);
browser_view->SetBackgroundColor(transparent);
// Create the Window. It will show itself after creation.
CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view));
CefRefPtr<CefWindow> top_window = CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view));
top_window->SetBackgroundColor(transparent);
} else {
// Information used when creating the native window.
CefWindowInfo window_info;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment