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

Side by Side Diff: ui/wm/core/shadow_controller.cc

Issue 797503006: Revert "Don't show the shadow for maximized/fullscreen window" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/wm/core/shadow_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
14 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
15 #include "ui/aura/env_observer.h" 14 #include "ui/aura/env_observer.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/aura/window_observer.h" 16 #include "ui/aura/window_observer.h"
18 #include "ui/base/ui_base_types.h"
19 #include "ui/compositor/layer.h" 17 #include "ui/compositor/layer.h"
20 #include "ui/wm/core/shadow.h" 18 #include "ui/wm/core/shadow.h"
21 #include "ui/wm/core/shadow_types.h" 19 #include "ui/wm/core/shadow_types.h"
22 #include "ui/wm/core/window_util.h" 20 #include "ui/wm/core/window_util.h"
23 #include "ui/wm/public/activation_client.h" 21 #include "ui/wm/public/activation_client.h"
24 22
25 using std::make_pair; 23 using std::make_pair;
26 24
27 namespace wm { 25 namespace wm {
28 26
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 162
165 void ShadowController::Impl::OnWindowInitialized(aura::Window* window) { 163 void ShadowController::Impl::OnWindowInitialized(aura::Window* window) {
166 observer_manager_.Add(window); 164 observer_manager_.Add(window);
167 SetShadowType(window, GetShadowTypeFromWindow(window)); 165 SetShadowType(window, GetShadowTypeFromWindow(window));
168 HandlePossibleShadowVisibilityChange(window); 166 HandlePossibleShadowVisibilityChange(window);
169 } 167 }
170 168
171 void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window, 169 void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window,
172 const void* key, 170 const void* key,
173 intptr_t old) { 171 intptr_t old) {
174 if (key == kShadowTypeKey || key == aura::client::kShowStateKey) { 172 if (key == kShadowTypeKey) {
175 HandlePossibleShadowVisibilityChange(window); 173 HandlePossibleShadowVisibilityChange(window);
176 return; 174 return;
177 } 175 }
178 } 176 }
179 177
180 void ShadowController::Impl::OnWindowBoundsChanged( 178 void ShadowController::Impl::OnWindowBoundsChanged(
181 aura::Window* window, 179 aura::Window* window,
182 const gfx::Rect& old_bounds, 180 const gfx::Rect& old_bounds,
183 const gfx::Rect& new_bounds) { 181 const gfx::Rect& new_bounds) {
184 Shadow* shadow = GetShadowForWindow(window); 182 Shadow* shadow = GetShadowForWindow(window);
(...skipping 17 matching lines...) Expand all
202 Shadow* shadow = GetShadowForWindow(lost_active); 200 Shadow* shadow = GetShadowForWindow(lost_active);
203 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { 201 if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) {
204 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, 202 shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active,
205 gained_active)); 203 gained_active));
206 } 204 }
207 } 205 }
208 } 206 }
209 207
210 bool ShadowController::Impl::ShouldShowShadowForWindow( 208 bool ShadowController::Impl::ShouldShowShadowForWindow(
211 aura::Window* window) const { 209 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
219 const ShadowType type = GetShadowType(window); 210 const ShadowType type = GetShadowType(window);
220 switch (type) { 211 switch (type) {
221 case SHADOW_TYPE_NONE: 212 case SHADOW_TYPE_NONE:
222 return false; 213 return false;
223 case SHADOW_TYPE_RECTANGULAR: 214 case SHADOW_TYPE_RECTANGULAR:
224 case SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE: 215 case SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE:
225 return true; 216 return true;
226 default: 217 default:
227 NOTREACHED() << "Unknown shadow type " << type; 218 NOTREACHED() << "Unknown shadow type " << type;
228 return false; 219 return false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 impl_->OnWindowActivated(gained_active, lost_active); 276 impl_->OnWindowActivated(gained_active, lost_active);
286 } 277 }
287 278
288 // ShadowController::TestApi --------------------------------------------------- 279 // ShadowController::TestApi ---------------------------------------------------
289 280
290 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { 281 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) {
291 return controller_->impl_->GetShadowForWindow(window); 282 return controller_->impl_->GetShadowForWindow(window);
292 } 283 }
293 284
294 } // namespace wm 285 } // namespace wm
OLDNEW
« no previous file with comments | « no previous file | ui/wm/core/shadow_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698