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

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

Issue 954123002: Remove wm::SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 switch (window->type()) { 45 switch (window->type()) {
46 case ui::wm::WINDOW_TYPE_MENU: 46 case ui::wm::WINDOW_TYPE_MENU:
47 case ui::wm::WINDOW_TYPE_TOOLTIP: 47 case ui::wm::WINDOW_TYPE_TOOLTIP:
48 return true; 48 return true;
49 default: 49 default:
50 break; 50 break;
51 } 51 }
52 return false; 52 return false;
53 } 53 }
54 54
55 bool IsShadowAlwaysActive(aura::Window* window) {
56 return GetShadowType(window) == SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE;
57 }
58
59 Shadow::Style GetShadowStyleForWindow(aura::Window* window) { 55 Shadow::Style GetShadowStyleForWindow(aura::Window* window) {
60 return ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL : 56 return ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL :
61 ((IsActiveWindow(window) || IsShadowAlwaysActive(window)) ? 57 (IsActiveWindow(window) ? Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE);
62 Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE);
63 } 58 }
64 59
65 // Returns the shadow style to be applied to |losing_active| when it is losing 60 // Returns the shadow style to be applied to |losing_active| when it is losing
66 // active to |gaining_active|. |gaining_active| may be of a type that hides when 61 // active to |gaining_active|. |gaining_active| may be of a type that hides when
67 // inactive, and as such we do not want to render |losing_active| as inactive. 62 // inactive, and as such we do not want to render |losing_active| as inactive.
68 Shadow::Style GetShadowStyleForWindowLosingActive( 63 Shadow::Style GetShadowStyleForWindowLosingActive(
69 aura::Window* losing_active, 64 aura::Window* losing_active,
70 aura::Window* gaining_active) { 65 aura::Window* gaining_active) {
71 if (IsShadowAlwaysActive(losing_active))
72 return Shadow::STYLE_ACTIVE;
73
74 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) { 66 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) {
75 aura::Window::Windows::const_iterator it = 67 aura::Window::Windows::const_iterator it =
76 std::find(GetTransientChildren(losing_active).begin(), 68 std::find(GetTransientChildren(losing_active).begin(),
77 GetTransientChildren(losing_active).end(), 69 GetTransientChildren(losing_active).end(),
78 gaining_active); 70 gaining_active);
79 if (it != GetTransientChildren(losing_active).end()) 71 if (it != GetTransientChildren(losing_active).end())
80 return Shadow::STYLE_ACTIVE; 72 return Shadow::STYLE_ACTIVE;
81 } 73 }
82 return Shadow::STYLE_INACTIVE; 74 return Shadow::STYLE_INACTIVE;
83 } 75 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (show_state == ui::SHOW_STATE_FULLSCREEN || 206 if (show_state == ui::SHOW_STATE_FULLSCREEN ||
215 show_state == ui::SHOW_STATE_MAXIMIZED) { 207 show_state == ui::SHOW_STATE_MAXIMIZED) {
216 return SHADOW_TYPE_NONE; 208 return SHADOW_TYPE_NONE;
217 } 209 }
218 210
219 const ShadowType type = GetShadowType(window); 211 const ShadowType type = GetShadowType(window);
220 switch (type) { 212 switch (type) {
221 case SHADOW_TYPE_NONE: 213 case SHADOW_TYPE_NONE:
222 return false; 214 return false;
223 case SHADOW_TYPE_RECTANGULAR: 215 case SHADOW_TYPE_RECTANGULAR:
224 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;
229 } 220 }
230 } 221 }
231 222
232 Shadow* ShadowController::Impl::GetShadowForWindow(aura::Window* window) { 223 Shadow* ShadowController::Impl::GetShadowForWindow(aura::Window* window) {
233 WindowShadowMap::const_iterator it = window_shadows_.find(window); 224 WindowShadowMap::const_iterator it = window_shadows_.find(window);
234 return it != window_shadows_.end() ? it->second.get() : NULL; 225 return it != window_shadows_.end() ? it->second.get() : NULL;
(...skipping 50 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