| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/dim_window.h" | 8 #include "ash/wm/dim_window.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 // static | 79 // static |
| 80 aura::Window* ScreenDimmer::FindContainer(int container_id) { | 80 aura::Window* ScreenDimmer::FindContainer(int container_id) { |
| 81 aura::Window* primary = Shell::GetPrimaryRootWindow(); | 81 aura::Window* primary = Shell::GetPrimaryRootWindow(); |
| 82 return container_id == kRootWindowMagicId | 82 return container_id == kRootWindowMagicId |
| 83 ? primary | 83 ? primary |
| 84 : primary->GetChildById(container_id); | 84 : primary->GetChildById(container_id); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ScreenDimmer::OnRootWindowAdded(aura::Window* root_window) { | 87 void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) { |
| 88 Update(is_dimming_); | 88 Update(is_dimming_); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ScreenDimmer::Update(bool should_dim) { | 91 void ScreenDimmer::Update(bool should_dim) { |
| 92 for (aura::Window* container : GetAllContainers(container_id_)) { | 92 for (aura::Window* container : GetAllContainers(container_id_)) { |
| 93 DimWindow* dim = DimWindow::Get(container); | 93 DimWindow* dim = DimWindow::Get(container); |
| 94 if (should_dim) { | 94 if (should_dim) { |
| 95 if (!dim) { | 95 if (!dim) { |
| 96 dim = new DimWindow(container); | 96 dim = new DimWindow(container); |
| 97 dim->SetDimOpacity(target_opacity_); | 97 dim->SetDimOpacity(target_opacity_); |
| 98 } | 98 } |
| 99 if (at_bottom_) | 99 if (at_bottom_) |
| 100 dim->parent()->StackChildAtBottom(dim); | 100 dim->parent()->StackChildAtBottom(dim); |
| 101 else | 101 else |
| 102 dim->parent()->StackChildAtTop(dim); | 102 dim->parent()->StackChildAtTop(dim); |
| 103 dim->Show(); | 103 dim->Show(); |
| 104 } else { | 104 } else { |
| 105 if (dim) { | 105 if (dim) { |
| 106 dim->Hide(); | 106 dim->Hide(); |
| 107 delete dim; | 107 delete dim; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace ash | 113 } // namespace ash |
| OLD | NEW |