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 15 matching lines...) Expand all Loading... |
26 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
27 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
29 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
30 #include "ui/base/ui_base_types.h" | 30 #include "ui/base/ui_base_types.h" |
31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
32 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 32 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
33 #include "ui/events/event_utils.h" | 33 #include "ui/events/event_utils.h" |
34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
35 #include "ui/views/corewm/window_animations.h" | 35 #include "ui/views/corewm/window_animations.h" |
| 36 #include "ui/views/corewm/window_util.h" |
36 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
37 | 38 |
38 using aura::Window; | 39 using aura::Window; |
39 | 40 |
40 namespace ash { | 41 namespace ash { |
41 namespace internal { | 42 namespace internal { |
42 | 43 |
43 // Returns a string containing the names of all the children of |window| (in | 44 // Returns a string containing the names of all the children of |window| (in |
44 // order). Each entry is separated by a space. | 45 // order). Each entry is separated by a space. |
45 std::string GetWindowNames(const aura::Window* window) { | 46 std::string GetWindowNames(const aura::Window* window) { |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 TEST_F(WorkspaceControllerTest, TransientParent) { | 671 TEST_F(WorkspaceControllerTest, TransientParent) { |
671 // Normal window with no transient parent. | 672 // Normal window with no transient parent. |
672 scoped_ptr<Window> w2(CreateTestWindow()); | 673 scoped_ptr<Window> w2(CreateTestWindow()); |
673 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 674 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
674 w2->Show(); | 675 w2->Show(); |
675 wm::ActivateWindow(w2.get()); | 676 wm::ActivateWindow(w2.get()); |
676 | 677 |
677 // Window with a transient parent. We set the transient parent to the root, | 678 // Window with a transient parent. We set the transient parent to the root, |
678 // which would never happen but is enough to exercise the bug. | 679 // which would never happen but is enough to exercise the bug. |
679 scoped_ptr<Window> w1(CreateTestWindowUnparented()); | 680 scoped_ptr<Window> w1(CreateTestWindowUnparented()); |
680 Shell::GetInstance()->GetPrimaryRootWindow()->AddTransientChild(w1.get()); | 681 views::corewm::AddTransientChild( |
| 682 Shell::GetInstance()->GetPrimaryRootWindow(), w1.get()); |
681 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); | 683 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); |
682 ParentWindowInPrimaryRootWindow(w1.get()); | 684 ParentWindowInPrimaryRootWindow(w1.get()); |
683 w1->Show(); | 685 w1->Show(); |
684 wm::ActivateWindow(w1.get()); | 686 wm::ActivateWindow(w1.get()); |
685 | 687 |
686 // The window with the transient parent should get added to the same parent as | 688 // The window with the transient parent should get added to the same parent as |
687 // the normal window. | 689 // the normal window. |
688 EXPECT_EQ(w2->parent(), w1->parent()); | 690 EXPECT_EQ(w2->parent(), w1->parent()); |
689 } | 691 } |
690 | 692 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 // |status_bubble| is made a transient child of |browser| and as a result | 1127 // |status_bubble| is made a transient child of |browser| and as a result |
1126 // owned by |browser|. | 1128 // owned by |browser|. |
1127 aura::test::TestWindowDelegate* status_bubble_delegate = | 1129 aura::test::TestWindowDelegate* status_bubble_delegate = |
1128 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); | 1130 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); |
1129 status_bubble_delegate->set_can_focus(false); | 1131 status_bubble_delegate->set_can_focus(false); |
1130 Window* status_bubble = | 1132 Window* status_bubble = |
1131 aura::test::CreateTestWindowWithDelegate(status_bubble_delegate, | 1133 aura::test::CreateTestWindowWithDelegate(status_bubble_delegate, |
1132 ui::wm::WINDOW_TYPE_POPUP, | 1134 ui::wm::WINDOW_TYPE_POPUP, |
1133 gfx::Rect(5, 6, 7, 8), | 1135 gfx::Rect(5, 6, 7, 8), |
1134 NULL); | 1136 NULL); |
1135 browser->AddTransientChild(status_bubble); | 1137 views::corewm::AddTransientChild(browser.get(), status_bubble); |
1136 ParentWindowInPrimaryRootWindow(status_bubble); | 1138 ParentWindowInPrimaryRootWindow(status_bubble); |
1137 status_bubble->SetName("status_bubble"); | 1139 status_bubble->SetName("status_bubble"); |
1138 | 1140 |
1139 scoped_ptr<Window> app(aura::test::CreateTestWindowWithDelegate( | 1141 scoped_ptr<Window> app(aura::test::CreateTestWindowWithDelegate( |
1140 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL)); | 1142 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL)); |
1141 app->SetName("app"); | 1143 app->SetName("app"); |
1142 ParentWindowInPrimaryRootWindow(app.get()); | 1144 ParentWindowInPrimaryRootWindow(app.get()); |
1143 | 1145 |
1144 aura::Window* parent = browser->parent(); | 1146 aura::Window* parent = browser->parent(); |
1145 | 1147 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 // Apply a transform on |second|. After the transform is applied, the window | 1355 // Apply a transform on |second|. After the transform is applied, the window |
1354 // should no longer be targetted. | 1356 // should no longer be targetted. |
1355 gfx::Transform transform; | 1357 gfx::Transform transform; |
1356 transform.Translate(70, 40); | 1358 transform.Translate(70, 40); |
1357 second->SetTransform(transform); | 1359 second->SetTransform(transform); |
1358 } | 1360 } |
1359 } | 1361 } |
1360 | 1362 |
1361 } // namespace internal | 1363 } // namespace internal |
1362 } // namespace ash | 1364 } // namespace ash |
OLD | NEW |