| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/wm/window_dimmer.h" |
| 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window_user_data.h" |
| 9 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/wm/dim_window.h" | |
| 13 //#include "ui/aura/window_event_dispatcher.h" | |
| 14 #include "ui/aura/test/test_windows.h" | 16 #include "ui/aura/test/test_windows.h" |
| 15 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 16 | 18 |
| 17 namespace ash { | 19 namespace ash { |
| 18 namespace test { | 20 namespace test { |
| 19 | 21 |
| 20 class ScreenDimmerTest : public AshTestBase { | 22 class ScreenDimmerTest : public AshTestBase { |
| 21 public: | 23 public: |
| 22 ScreenDimmerTest() : dimmer_(nullptr) {} | 24 ScreenDimmerTest() : dimmer_(nullptr) {} |
| 23 ~ScreenDimmerTest() override {} | 25 ~ScreenDimmerTest() override {} |
| 24 | 26 |
| 25 void SetUp() override { | 27 void SetUp() override { |
| 26 AshTestBase::SetUp(); | 28 AshTestBase::SetUp(); |
| 27 dimmer_ = ScreenDimmer::GetForRoot(); | 29 dimmer_ = ScreenDimmer::GetForRoot(); |
| 28 } | 30 } |
| 29 | 31 |
| 30 aura::Window* GetDimWindow() { | 32 aura::Window* GetDimWindow() { |
| 31 return DimWindow::Get(Shell::GetPrimaryRootWindow()); | 33 WindowDimmer* window_dimmer = |
| 34 dimmer_->window_dimmers_->Get(WmShell::Get()->GetPrimaryRootWindow()); |
| 35 return window_dimmer ? WmWindowAura::GetAuraWindow(window_dimmer->window()) |
| 36 : nullptr; |
| 32 } | 37 } |
| 33 | 38 |
| 34 ui::Layer* GetDimWindowLayer() { | 39 ui::Layer* GetDimWindowLayer() { |
| 35 aura::Window* window = GetDimWindow(); | 40 aura::Window* window = GetDimWindow(); |
| 36 return window ? window->layer() : nullptr; | 41 return window ? window->layer() : nullptr; |
| 37 } | 42 } |
| 38 | 43 |
| 39 protected: | 44 protected: |
| 40 ScreenDimmer* dimmer_; // not owned | 45 ScreenDimmer* dimmer_; // not owned |
| 41 | 46 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 117 |
| 113 dim_iter = std::find(root_window->children().begin(), | 118 dim_iter = std::find(root_window->children().begin(), |
| 114 root_window->children().end(), GetDimWindow()); | 119 root_window->children().end(), GetDimWindow()); |
| 115 ASSERT_TRUE(dim_iter != root_window->children().end()); | 120 ASSERT_TRUE(dim_iter != root_window->children().end()); |
| 116 // Dom layer is at the bottom. | 121 // Dom layer is at the bottom. |
| 117 EXPECT_EQ(*dim_iter, *root_window->children().begin()); | 122 EXPECT_EQ(*dim_iter, *root_window->children().begin()); |
| 118 } | 123 } |
| 119 | 124 |
| 120 } // namespace test | 125 } // namespace test |
| 121 } // namespace ash | 126 } // namespace ash |
| OLD | NEW |