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/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/window_user_data.h" | 9 #include "ash/window_user_data.h" |
10 #include "ash/wm/container_finder.h" | 10 #include "ash/wm/container_finder.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 Update(should_dim); | 46 Update(should_dim); |
47 } | 47 } |
48 | 48 |
49 aura::Window::Windows ScreenDimmer::GetAllContainers() { | 49 aura::Window::Windows ScreenDimmer::GetAllContainers() { |
50 return container_ == Container::ROOT | 50 return container_ == Container::ROOT |
51 ? Shell::GetAllRootWindows() | 51 ? Shell::GetAllRootWindows() |
52 : wm::GetContainersFromAllRootWindows( | 52 : wm::GetContainersFromAllRootWindows( |
53 ash::kShellWindowId_LockScreenContainersContainer); | 53 ash::kShellWindowId_LockScreenContainersContainer); |
54 } | 54 } |
55 | 55 |
56 void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) { | 56 void ScreenDimmer::OnRootWindowAdded(aura::Window* root_window) { |
57 Update(is_dimming_); | 57 Update(is_dimming_); |
58 } | 58 } |
59 | 59 |
60 void ScreenDimmer::Update(bool should_dim) { | 60 void ScreenDimmer::Update(bool should_dim) { |
61 for (aura::Window* container : GetAllContainers()) { | 61 for (aura::Window* container : GetAllContainers()) { |
62 WindowDimmer* window_dimmer = window_dimmers_->Get(container); | 62 WindowDimmer* window_dimmer = window_dimmers_->Get(container); |
63 if (should_dim) { | 63 if (should_dim) { |
64 if (!window_dimmer) { | 64 if (!window_dimmer) { |
65 window_dimmers_->Set(container, | 65 window_dimmers_->Set(container, |
66 base::MakeUnique<WindowDimmer>(container)); | 66 base::MakeUnique<WindowDimmer>(container)); |
67 window_dimmer = window_dimmers_->Get(container); | 67 window_dimmer = window_dimmers_->Get(container); |
68 window_dimmer->SetDimOpacity(container_ == Container::ROOT | 68 window_dimmer->SetDimOpacity(container_ == Container::ROOT |
69 ? kDimmingLayerOpacityForRoot | 69 ? kDimmingLayerOpacityForRoot |
70 : kDimmingLayerOpacityForLockScreen); | 70 : kDimmingLayerOpacityForLockScreen); |
71 } | 71 } |
72 if (at_bottom_) | 72 if (at_bottom_) |
73 container->StackChildAtBottom(window_dimmer->window()); | 73 container->StackChildAtBottom(window_dimmer->window()); |
74 else | 74 else |
75 container->StackChildAtTop(window_dimmer->window()); | 75 container->StackChildAtTop(window_dimmer->window()); |
76 window_dimmer->window()->Show(); | 76 window_dimmer->window()->Show(); |
77 } else if (window_dimmer) { | 77 } else if (window_dimmer) { |
78 window_dimmers_->Set(container, nullptr); | 78 window_dimmers_->Set(container, nullptr); |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 } // namespace ash | 83 } // namespace ash |
OLD | NEW |