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

Unified Diff: apps/ui/views/native_app_window_views.cc

Issue 375183002: Add app.window.alphaEnabled() and onAlphaEnabledChanged. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 6 years, 5 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 | « apps/ui/views/native_app_window_views.h ('k') | chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/ui/views/native_app_window_views.cc
diff --git a/apps/ui/views/native_app_window_views.cc b/apps/ui/views/native_app_window_views.cc
index 62b941d9e58db4628f080934c6bf49b1660b76a8..da84d8a1822e7013d36aa806c7c8be9554bb7217 100644
--- a/apps/ui/views/native_app_window_views.cc
+++ b/apps/ui/views/native_app_window_views.cc
@@ -27,14 +27,12 @@ NativeAppWindowViews::NativeAppWindowViews()
web_view_(NULL),
widget_(NULL),
frameless_(false),
- transparent_background_(false),
resizable_(false) {}
void NativeAppWindowViews::Init(AppWindow* app_window,
const AppWindow::CreateParams& create_params) {
app_window_ = app_window;
frameless_ = create_params.frame == AppWindow::FRAME_NONE;
- transparent_background_ = create_params.transparent_background;
resizable_ = create_params.resizable;
size_constraints_.set_minimum_size(
create_params.GetContentMinimumSize(gfx::Insets()));
@@ -53,6 +51,10 @@ NativeAppWindowViews::~NativeAppWindowViews() {
web_view_->SetWebContents(NULL);
}
+void NativeAppWindowViews::OnCanHaveAlphaEnabledChanged() {
+ app_window_->OnNativeWindowChanged();
+}
+
void NativeAppWindowViews::InitializeWindow(
AppWindow* app_window,
const AppWindow::CreateParams& create_params) {
@@ -260,7 +262,8 @@ void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget,
void NativeAppWindowViews::RenderViewCreated(
content::RenderViewHost* render_view_host) {
- if (transparent_background_) {
+ if (app_window_->requested_transparent_background() &&
+ CanHaveAlphaEnabled()) {
content::RenderWidgetHostView* view = render_view_host->GetView();
DCHECK(view);
view->SetBackgroundOpaque(false);
@@ -398,4 +401,8 @@ void NativeAppWindowViews::SetContentSizeConstraints(
size_constraints_.set_maximum_size(max_size);
}
+bool NativeAppWindowViews::CanHaveAlphaEnabled() const {
+ return widget_->IsTranslucentWindowOpacitySupported();
+}
+
} // namespace apps
« no previous file with comments | « apps/ui/views/native_app_window_views.h ('k') | chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698