Chromium Code Reviews| 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 "ash/wm/screen_dimmer.h" | 5 #include "ash/wm/screen_dimmer.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | |
| 8 #include "ash/common/wm/window_dimmer.h" | |
| 7 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 9 #include "ash/wm/dim_window.h" | |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 12 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
| 13 #include "ui/compositor/layer.h" | 14 #include "ui/compositor/layer.h" |
| 14 #include "ui/compositor/scoped_layer_animation_settings.h" | 15 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 DECLARE_WINDOW_PROPERTY_TYPE(ash::ScreenDimmer*); | 19 DECLARE_WINDOW_PROPERTY_TYPE(ash::ScreenDimmer*); |
| 19 | 20 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 ? primary | 85 ? primary |
| 85 : primary->GetChildById(container_id); | 86 : primary->GetChildById(container_id); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) { | 89 void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) { |
| 89 Update(is_dimming_); | 90 Update(is_dimming_); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void ScreenDimmer::Update(bool should_dim) { | 93 void ScreenDimmer::Update(bool should_dim) { |
| 93 for (aura::Window* container : GetAllContainers(container_id_)) { | 94 for (aura::Window* container : GetAllContainers(container_id_)) { |
| 94 DimWindow* dim = DimWindow::Get(container); | 95 WindowDimmer* dim = WindowDimmer::Get(WmWindowAura::Get(container)); |
| 95 if (should_dim) { | 96 if (should_dim) { |
| 96 if (!dim) { | 97 if (!dim) { |
| 97 dim = new DimWindow(container); | 98 dim = new WindowDimmer(WmWindowAura::Get(container)); |
|
James Cook
2016/09/09 00:03:36
Or maybe ScreenDimmer could store a set of WindowD
sky
2016/09/09 03:50:04
You're right that I could be more explicit and mai
| |
| 98 dim->SetDimOpacity(target_opacity_); | 99 dim->SetDimOpacity(target_opacity_); |
| 99 } | 100 } |
| 100 if (at_bottom_) | 101 if (at_bottom_) |
| 101 dim->parent()->StackChildAtBottom(dim); | 102 dim->parent()->StackChildAtBottom(dim->window()); |
| 102 else | 103 else |
| 103 dim->parent()->StackChildAtTop(dim); | 104 dim->parent()->StackChildAtTop(dim->window()); |
| 104 dim->Show(); | 105 dim->window()->Show(); |
| 105 } else { | 106 } else if (dim) { |
| 106 if (dim) { | 107 dim->Destroy(); |
| 107 dim->Hide(); | |
| 108 delete dim; | |
| 109 } | |
| 110 } | 108 } |
| 111 } | 109 } |
| 112 } | 110 } |
| 113 | 111 |
| 114 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |