summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/tooltips/tooltip_controller.cc1
-rw-r--r--ash/wm/shadow_controller.cc10
-rw-r--r--ui/aura/window.cc8
-rw-r--r--ui/aura/window.h6
-rw-r--r--ui/views/widget/native_widget_aura.cc2
5 files changed, 22 insertions, 5 deletions
diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc
index 08d2bb4..85f2762 100644
--- a/ash/tooltips/tooltip_controller.cc
+++ b/ash/tooltips/tooltip_controller.cc
@@ -113,7 +113,6 @@ views::Widget* CreateTooltip() {
params.type = views::Widget::InitParams::TYPE_TOOLTIP;
params.keep_on_top = true;
params.accept_events = false;
- params.transparent = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
return widget;
diff --git a/ash/wm/shadow_controller.cc b/ash/wm/shadow_controller.cc
index 6f5a530..58f27f9 100644
--- a/ash/wm/shadow_controller.cc
+++ b/ash/wm/shadow_controller.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,11 @@ namespace internal {
namespace {
-ShadowType GetShadowTypeFromWindowType(aura::Window* window) {
+ShadowType GetShadowTypeFromWindow(aura::Window* window) {
+ // No shadow for transparent window.
+ if (window->transparent())
+ return SHADOW_TYPE_NONE;
+
switch (window->type()) {
case aura::client::WINDOW_TYPE_NORMAL:
case aura::client::WINDOW_TYPE_PANEL:
@@ -54,7 +58,7 @@ ShadowController::~ShadowController() {
void ShadowController::OnWindowInitialized(aura::Window* window) {
window->AddObserver(this);
- SetShadowType(window, GetShadowTypeFromWindowType(window));
+ SetShadowType(window, GetShadowTypeFromWindow(window));
HandlePossibleShadowVisibilityChange(window);
}
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 5502f5d..a47d897 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -41,6 +41,7 @@ Window::Window(WindowDelegate* delegate)
parent_(NULL),
transient_parent_(NULL),
id_(-1),
+ transparent_(false),
user_data_(NULL),
stops_event_propagation_(false),
ignore_events_(false) {
@@ -100,6 +101,7 @@ void Window::Init(ui::Layer::LayerType layer_type) {
layer_->SetVisible(false);
layer_->set_delegate(this);
UpdateLayerName(name_);
+ layer_->SetFillsBoundsOpaquely(!transparent_);
RootWindow::GetInstance()->WindowInitialized(this);
}
@@ -117,6 +119,12 @@ void Window::SetName(const std::string& name) {
UpdateLayerName(name_);
}
+void Window::SetTransparent(bool transparent) {
+ // Cannot change transparent flag after the window is initialized.
+ DCHECK(!layer());
+ transparent_ = transparent;
+}
+
ui::Layer* Window::AcquireLayer() {
return layer_.release();
}
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 9fc775e..9d3a2fd 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -70,6 +70,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
const string16 title() const { return title_; }
void set_title(const string16& title) { title_ = title; }
+ bool transparent() const { return transparent_; }
+ void SetTransparent(bool transparent);
+
ui::Layer* layer() { return layer_.get(); }
const ui::Layer* layer() const { return layer_.get(); }
@@ -341,6 +344,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
string16 title_;
+ // Whether layer is initialized as non-opaque.
+ bool transparent_;
+
scoped_ptr<EventFilter> event_filter_;
scoped_ptr<LayoutManager> layout_manager_;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 71d25cb..5842627 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -166,13 +166,13 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
window_->SetType(GetAuraWindowTypeForWidgetType(window_type));
// TODO(jamescook): Should this use params.show_state instead?
window_->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
+ window_->SetTransparent(params.transparent);
window_->Init(params.create_texture_for_layer ?
ui::Layer::LAYER_HAS_TEXTURE :
ui::Layer::LAYER_HAS_NO_TEXTURE);
if (window_type == Widget::InitParams::TYPE_CONTROL)
window_->Show();
- window_->layer()->SetFillsBoundsOpaquely(!params.transparent);
delegate_->OnNativeWidgetCreated();
window_->SetBounds(params.bounds);
if (window_type == Widget::InitParams::TYPE_CONTROL) {