| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/shelf/shelf_layout_manager.h" | 11 #include "ash/common/shelf/shelf_layout_manager.h" |
| 12 #include "ash/common/shelf/shelf_widget.h" | 12 #include "ash/common/shelf/shelf_widget.h" |
| 13 #include "ash/common/shelf/wm_shelf.h" | 13 #include "ash/common/shelf/wm_shelf.h" |
| 14 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 14 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
| 17 #include "ash/display/mouse_cursor_event_filter.h" | 17 #include "ash/display/mouse_cursor_event_filter.h" |
| 18 #include "ash/drag_drop/drag_drop_controller.h" | 18 #include "ash/drag_drop/drag_drop_controller.h" |
| 19 #include "ash/public/cpp/shell_window_ids.h" | 19 #include "ash/public/cpp/shell_window_ids.h" |
| 20 #include "ash/root_window_controller.h" | 20 #include "ash/root_window_controller.h" |
| 21 #include "ash/test/ash_test_base.h" | 21 #include "ash/test/ash_test_base.h" |
| 22 #include "ash/test/shell_test_api.h" | 22 #include "ash/test/shell_test_api.h" |
| 23 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
| 24 #include "base/macros.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
| 27 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
| 28 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 29 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 30 #include "ui/base/models/simple_menu_model.h" | 31 #include "ui/base/models/simple_menu_model.h" |
| 31 #include "ui/events/test/event_generator.h" | 32 #include "ui/events/test/event_generator.h" |
| 32 #include "ui/events/test/events_test_utils.h" | 33 #include "ui/events/test/events_test_utils.h" |
| 33 #include "ui/events/test/test_event_handler.h" | 34 #include "ui/events/test/test_event_handler.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 kShellWindowId_DefaultContainer); | 50 kShellWindowId_DefaultContainer); |
| 50 } | 51 } |
| 51 | 52 |
| 52 aura::Window* GetAlwaysOnTopContainer() { | 53 aura::Window* GetAlwaysOnTopContainer() { |
| 53 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 54 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| 54 kShellWindowId_AlwaysOnTopContainer); | 55 kShellWindowId_AlwaysOnTopContainer); |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Expect ALL the containers! | 58 // Expect ALL the containers! |
| 58 void ExpectAllContainers() { | 59 void ExpectAllContainers() { |
| 60 // Validate no duplicate container IDs. |
| 61 const size_t all_shell_container_ids_size = arraysize(kAllShellContainerIds); |
| 62 std::set<int32_t> container_ids; |
| 63 for (size_t i = 0; i < all_shell_container_ids_size; ++i) |
| 64 EXPECT_TRUE(container_ids.insert(kAllShellContainerIds[i]).second); |
| 65 |
| 59 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 66 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 60 EXPECT_TRUE( | 67 EXPECT_TRUE( |
| 61 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer)); | 68 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer)); |
| 62 EXPECT_TRUE( | 69 EXPECT_TRUE( |
| 63 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); | 70 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); |
| 64 EXPECT_TRUE( | 71 EXPECT_TRUE( |
| 65 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); | 72 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); |
| 66 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); | 73 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); |
| 67 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); | 74 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); |
| 68 EXPECT_TRUE( | 75 EXPECT_TRUE( |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // the case with classic-ash where embedders can separately create | 519 // the case with classic-ash where embedders can separately create |
| 513 // aura::Windows. | 520 // aura::Windows. |
| 514 if (WmShell::Get()->IsRunningInMash()) | 521 if (WmShell::Get()->IsRunningInMash()) |
| 515 return; | 522 return; |
| 516 | 523 |
| 517 window_.reset(new aura::Window(NULL)); | 524 window_.reset(new aura::Window(NULL)); |
| 518 window_->Init(ui::LAYER_NOT_DRAWN); | 525 window_->Init(ui::LAYER_NOT_DRAWN); |
| 519 } | 526 } |
| 520 | 527 |
| 521 } // namespace ash | 528 } // namespace ash |
| OLD | NEW |