| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 34 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 35 #include "ui/events/event_utils.h" | 35 #include "ui/events/event_utils.h" |
| 36 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
| 37 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 38 #include "ui/wm/core/window_animations.h" | 38 #include "ui/wm/core/window_animations.h" |
| 39 #include "ui/wm/core/window_util.h" | 39 #include "ui/wm/core/window_util.h" |
| 40 | 40 |
| 41 using aura::Window; | 41 using aura::Window; |
| 42 | 42 |
| 43 namespace ash { | 43 namespace ash { |
| 44 namespace internal { | |
| 45 | 44 |
| 46 // Returns a string containing the names of all the children of |window| (in | 45 // Returns a string containing the names of all the children of |window| (in |
| 47 // order). Each entry is separated by a space. | 46 // order). Each entry is separated by a space. |
| 48 std::string GetWindowNames(const aura::Window* window) { | 47 std::string GetWindowNames(const aura::Window* window) { |
| 49 std::string result; | 48 std::string result; |
| 50 for (size_t i = 0; i < window->children().size(); ++i) { | 49 for (size_t i = 0; i < window->children().size(); ++i) { |
| 51 if (i != 0) | 50 if (i != 0) |
| 52 result += " "; | 51 result += " "; |
| 53 result += window->children()[i]->name(); | 52 result += window->children()[i]->name(); |
| 54 } | 53 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 aura::Window* CreateTestPanel(aura::WindowDelegate* delegate, | 120 aura::Window* CreateTestPanel(aura::WindowDelegate* delegate, |
| 122 const gfx::Rect& bounds) { | 121 const gfx::Rect& bounds) { |
| 123 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 122 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 124 delegate, | 123 delegate, |
| 125 ui::wm::WINDOW_TYPE_PANEL, | 124 ui::wm::WINDOW_TYPE_PANEL, |
| 126 0, | 125 0, |
| 127 bounds); | 126 bounds); |
| 128 test::TestShelfDelegate* shelf_delegate = | 127 test::TestShelfDelegate* shelf_delegate = |
| 129 test::TestShelfDelegate::instance(); | 128 test::TestShelfDelegate::instance(); |
| 130 shelf_delegate->AddShelfItem(window); | 129 shelf_delegate->AddShelfItem(window); |
| 131 PanelLayoutManager* manager = | 130 PanelLayoutManager* manager = static_cast<PanelLayoutManager*>( |
| 132 static_cast<PanelLayoutManager*>( | 131 Shell::GetContainer(window->GetRootWindow(), |
| 133 Shell::GetContainer(window->GetRootWindow(), | 132 kShellWindowId_PanelContainer)->layout_manager()); |
| 134 internal::kShellWindowId_PanelContainer)-> | |
| 135 layout_manager()); | |
| 136 manager->Relayout(); | 133 manager->Relayout(); |
| 137 return window; | 134 return window; |
| 138 } | 135 } |
| 139 | 136 |
| 140 aura::Window* GetDesktop() { | 137 aura::Window* GetDesktop() { |
| 141 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 138 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| 142 kShellWindowId_DefaultContainer); | 139 kShellWindowId_DefaultContainer); |
| 143 } | 140 } |
| 144 | 141 |
| 145 gfx::Rect GetFullscreenBounds(aura::Window* window) { | 142 gfx::Rect GetFullscreenBounds(aura::Window* window) { |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 if (!switches::UseDockedWindows()) | 1459 if (!switches::UseDockedWindows()) |
| 1463 return; | 1460 return; |
| 1464 aura::test::TestWindowDelegate delegate; | 1461 aura::test::TestWindowDelegate delegate; |
| 1465 // Make window smaller than the minimum docked area so that the window edges | 1462 // Make window smaller than the minimum docked area so that the window edges |
| 1466 // are exposed. | 1463 // are exposed. |
| 1467 delegate.set_maximum_size(gfx::Size(180, 200)); | 1464 delegate.set_maximum_size(gfx::Size(180, 200)); |
| 1468 scoped_ptr<Window> window(aura::test::CreateTestWindowWithDelegate(&delegate, | 1465 scoped_ptr<Window> window(aura::test::CreateTestWindowWithDelegate(&delegate, |
| 1469 123, gfx::Rect(20, 10, 100, 50), NULL)); | 1466 123, gfx::Rect(20, 10, 100, 50), NULL)); |
| 1470 ParentWindowInPrimaryRootWindow(window.get()); | 1467 ParentWindowInPrimaryRootWindow(window.get()); |
| 1471 aura::Window* docked_container = Shell::GetContainer( | 1468 aura::Window* docked_container = Shell::GetContainer( |
| 1472 window->GetRootWindow(), internal::kShellWindowId_DockedContainer); | 1469 window->GetRootWindow(), kShellWindowId_DockedContainer); |
| 1473 docked_container->AddChild(window.get()); | 1470 docked_container->AddChild(window.get()); |
| 1474 window->Show(); | 1471 window->Show(); |
| 1475 ui::EventTarget* root = window->GetRootWindow(); | 1472 ui::EventTarget* root = window->GetRootWindow(); |
| 1476 ui::EventTargeter* targeter = root->GetEventTargeter(); | 1473 ui::EventTargeter* targeter = root->GetEventTargeter(); |
| 1477 const gfx::Rect bounds = window->bounds(); | 1474 const gfx::Rect bounds = window->bounds(); |
| 1478 const int kNumPoints = 5; | 1475 const int kNumPoints = 5; |
| 1479 struct { | 1476 struct { |
| 1480 const char* direction; | 1477 const char* direction; |
| 1481 gfx::Point location; | 1478 gfx::Point location; |
| 1482 bool is_target_hit; | 1479 bool is_target_hit; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1501 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1498 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1502 ui::EventTimeForNow()); | 1499 ui::EventTimeForNow()); |
| 1503 target = targeter->FindTargetForEvent(root, &touch); | 1500 target = targeter->FindTargetForEvent(root, &touch); |
| 1504 if (points[i].is_target_hit) | 1501 if (points[i].is_target_hit) |
| 1505 EXPECT_EQ(window.get(), target); | 1502 EXPECT_EQ(window.get(), target); |
| 1506 else | 1503 else |
| 1507 EXPECT_NE(window.get(), target); | 1504 EXPECT_NE(window.get(), target); |
| 1508 } | 1505 } |
| 1509 } | 1506 } |
| 1510 | 1507 |
| 1511 } // namespace internal | |
| 1512 } // namespace ash | 1508 } // namespace ash |
| OLD | NEW |