OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/wm/core/shadow_controller.h" | 5 #include "ui/wm/core/shadow_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
14 #include "ui/aura/env_observer.h" | 15 #include "ui/aura/env_observer.h" |
15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/base/ui_base_types.h" |
17 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
18 #include "ui/wm/core/shadow.h" | 20 #include "ui/wm/core/shadow.h" |
19 #include "ui/wm/core/shadow_types.h" | 21 #include "ui/wm/core/shadow_types.h" |
20 #include "ui/wm/core/window_util.h" | 22 #include "ui/wm/core/window_util.h" |
21 #include "ui/wm/public/activation_client.h" | 23 #include "ui/wm/public/activation_client.h" |
22 | 24 |
23 using std::make_pair; | 25 using std::make_pair; |
24 | 26 |
25 namespace wm { | 27 namespace wm { |
26 | 28 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 164 |
163 void ShadowController::Impl::OnWindowInitialized(aura::Window* window) { | 165 void ShadowController::Impl::OnWindowInitialized(aura::Window* window) { |
164 observer_manager_.Add(window); | 166 observer_manager_.Add(window); |
165 SetShadowType(window, GetShadowTypeFromWindow(window)); | 167 SetShadowType(window, GetShadowTypeFromWindow(window)); |
166 HandlePossibleShadowVisibilityChange(window); | 168 HandlePossibleShadowVisibilityChange(window); |
167 } | 169 } |
168 | 170 |
169 void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window, | 171 void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window, |
170 const void* key, | 172 const void* key, |
171 intptr_t old) { | 173 intptr_t old) { |
172 if (key == kShadowTypeKey) { | 174 if (key == kShadowTypeKey || key == aura::client::kShowStateKey) { |
173 HandlePossibleShadowVisibilityChange(window); | 175 HandlePossibleShadowVisibilityChange(window); |
174 return; | 176 return; |
175 } | 177 } |
176 } | 178 } |
177 | 179 |
178 void ShadowController::Impl::OnWindowBoundsChanged( | 180 void ShadowController::Impl::OnWindowBoundsChanged( |
179 aura::Window* window, | 181 aura::Window* window, |
180 const gfx::Rect& old_bounds, | 182 const gfx::Rect& old_bounds, |
181 const gfx::Rect& new_bounds) { | 183 const gfx::Rect& new_bounds) { |
182 Shadow* shadow = GetShadowForWindow(window); | 184 Shadow* shadow = GetShadowForWindow(window); |
(...skipping 17 matching lines...) Expand all Loading... |
200 Shadow* shadow = GetShadowForWindow(lost_active); | 202 Shadow* shadow = GetShadowForWindow(lost_active); |
201 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { | 203 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { |
202 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, | 204 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, |
203 gained_active)); | 205 gained_active)); |
204 } | 206 } |
205 } | 207 } |
206 } | 208 } |
207 | 209 |
208 bool ShadowController::Impl::ShouldShowShadowForWindow( | 210 bool ShadowController::Impl::ShouldShowShadowForWindow( |
209 aura::Window* window) const { | 211 aura::Window* window) const { |
| 212 ui::WindowShowState show_state = |
| 213 window->GetProperty(aura::client::kShowStateKey); |
| 214 if (show_state == ui::SHOW_STATE_FULLSCREEN || |
| 215 show_state == ui::SHOW_STATE_MAXIMIZED) { |
| 216 return SHADOW_TYPE_NONE; |
| 217 } |
| 218 |
210 const ShadowType type = GetShadowType(window); | 219 const ShadowType type = GetShadowType(window); |
211 switch (type) { | 220 switch (type) { |
212 case SHADOW_TYPE_NONE: | 221 case SHADOW_TYPE_NONE: |
213 return false; | 222 return false; |
214 case SHADOW_TYPE_RECTANGULAR: | 223 case SHADOW_TYPE_RECTANGULAR: |
215 case SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE: | 224 case SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE: |
216 return true; | 225 return true; |
217 default: | 226 default: |
218 NOTREACHED() << "Unknown shadow type " << type; | 227 NOTREACHED() << "Unknown shadow type " << type; |
219 return false; | 228 return false; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 impl_->OnWindowActivated(gained_active, lost_active); | 285 impl_->OnWindowActivated(gained_active, lost_active); |
277 } | 286 } |
278 | 287 |
279 // ShadowController::TestApi --------------------------------------------------- | 288 // ShadowController::TestApi --------------------------------------------------- |
280 | 289 |
281 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { | 290 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { |
282 return controller_->impl_->GetShadowForWindow(window); | 291 return controller_->impl_->GetShadowForWindow(window); |
283 } | 292 } |
284 | 293 |
285 } // namespace wm | 294 } // namespace wm |
OLD | NEW |