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

Unified Diff: ash/wm/shadow_controller.cc

Issue 9414028: Aura: New window shadows, desktop background debug toggle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 8 years, 10 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 | « ash/wm/shadow_controller.h ('k') | ash/wm/shadow_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/shadow_controller.cc
diff --git a/ash/wm/shadow_controller.cc b/ash/wm/shadow_controller.cc
index 2f754533f30c8f8e310e70919a568d653bdd214f..ed7af826c3084d558f290c14813ed9eb7c1226b5 100644
--- a/ash/wm/shadow_controller.cc
+++ b/ash/wm/shadow_controller.cc
@@ -12,6 +12,7 @@
#include "ash/wm/window_properties.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "ui/aura/client/activation_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -31,9 +32,6 @@ ShadowType GetShadowTypeFromWindow(aura::Window* window) {
switch (window->type()) {
case aura::client::WINDOW_TYPE_NORMAL:
case aura::client::WINDOW_TYPE_PANEL:
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAuraTranslucentFrames) ?
- SHADOW_TYPE_NONE : SHADOW_TYPE_RECTANGULAR;
case aura::client::WINDOW_TYPE_MENU:
case aura::client::WINDOW_TYPE_TOOLTIP:
return SHADOW_TYPE_RECTANGULAR;
@@ -47,6 +45,8 @@ ShadowType GetShadowTypeFromWindow(aura::Window* window) {
ShadowController::ShadowController() {
aura::Env::GetInstance()->AddObserver(this);
+ // Watch for window activation changes.
+ aura::RootWindow::GetInstance()->AddObserver(this);
}
ShadowController::~ShadowController() {
@@ -54,6 +54,7 @@ ShadowController::~ShadowController() {
it != window_shadows_.end(); ++it) {
it->first->RemoveObserver(this);
}
+ aura::RootWindow::GetInstance()->RemoveObserver(this);
aura::Env::GetInstance()->RemoveObserver(this);
}
@@ -66,8 +67,20 @@ void ShadowController::OnWindowInitialized(aura::Window* window) {
void ShadowController::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
- if (key == kShadowTypeKey)
+ if (key == kShadowTypeKey) {
HandlePossibleShadowVisibilityChange(window);
+ return;
+ }
+ if (key == aura::client::kRootWindowActiveWindowKey) {
+ aura::Window* inactive = reinterpret_cast<aura::Window*>(old);
+ if (inactive)
+ HandleWindowActivationChange(inactive, false);
+ aura::Window* active =
+ window->GetProperty(aura::client::kRootWindowActiveWindowKey);
+ if (active)
+ HandleWindowActivationChange(active, true);
+ return;
+ }
}
void ShadowController::OnWindowBoundsChanged(aura::Window* window,
@@ -99,6 +112,13 @@ Shadow* ShadowController::GetShadowForWindow(aura::Window* window) {
return it != window_shadows_.end() ? it->second.get() : NULL;
}
+void ShadowController::HandleWindowActivationChange(aura::Window* window,
+ bool active) {
+ Shadow* shadow = GetShadowForWindow(window);
+ if (shadow)
+ shadow->SetStyle(active ? Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE);
+}
+
void ShadowController::HandlePossibleShadowVisibilityChange(
aura::Window* window) {
const bool should_show = ShouldShowShadowForWindow(window);
« no previous file with comments | « ash/wm/shadow_controller.h ('k') | ash/wm/shadow_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698