OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int docked_width(const DockedWindowLayoutManager* layout_manager) const { | 66 int docked_width(const DockedWindowLayoutManager* layout_manager) const { |
67 return layout_manager->docked_width_; | 67 return layout_manager->docked_width_; |
68 } | 68 } |
69 | 69 |
70 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { | 70 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { |
71 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 71 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
72 NULL, window_type_, 0, bounds); | 72 NULL, window_type_, 0, bounds); |
73 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { | 73 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { |
74 test::TestShelfDelegate* shelf_delegate = | 74 test::TestShelfDelegate* shelf_delegate = |
75 test::TestShelfDelegate::instance(); | 75 test::TestShelfDelegate::instance(); |
76 shelf_delegate->AddLauncherItem(window); | 76 shelf_delegate->AddShelfItem(window); |
77 PanelLayoutManager* manager = | 77 PanelLayoutManager* manager = |
78 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> | 78 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> |
79 layout_manager()); | 79 layout_manager()); |
80 manager->Relayout(); | 80 manager->Relayout(); |
81 } | 81 } |
82 return window; | 82 return window; |
83 } | 83 } |
84 | 84 |
85 aura::Window* CreateTestWindowWithDelegate( | 85 aura::Window* CreateTestWindowWithDelegate( |
86 const gfx::Rect& bounds, | 86 const gfx::Rect& bounds, |
87 aura::test::TestWindowDelegate* delegate) { | 87 aura::test::TestWindowDelegate* delegate) { |
88 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 88 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
89 delegate, window_type_, 0, bounds); | 89 delegate, window_type_, 0, bounds); |
90 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { | 90 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { |
91 test::TestShelfDelegate* shelf_delegate = | 91 test::TestShelfDelegate* shelf_delegate = |
92 test::TestShelfDelegate::instance(); | 92 test::TestShelfDelegate::instance(); |
93 shelf_delegate->AddLauncherItem(window); | 93 shelf_delegate->AddShelfItem(window); |
94 PanelLayoutManager* manager = | 94 PanelLayoutManager* manager = |
95 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> | 95 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> |
96 layout_manager()); | 96 layout_manager()); |
97 manager->Relayout(); | 97 manager->Relayout(); |
98 } | 98 } |
99 return window; | 99 return window; |
100 } | 100 } |
101 | 101 |
102 aura::Window* GetPanelContainer(aura::Window* panel) { | 102 aura::Window* GetPanelContainer(aura::Window* panel) { |
103 return Shell::GetContainer(panel->GetRootWindow(), | 103 return Shell::GetContainer(panel->GetRootWindow(), |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); | 831 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); |
832 } | 832 } |
833 | 833 |
834 // Tests run twice - on both panels and normal windows | 834 // Tests run twice - on both panels and normal windows |
835 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 835 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
836 DockedWindowLayoutManagerTest, | 836 DockedWindowLayoutManagerTest, |
837 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 837 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
838 ui::wm::WINDOW_TYPE_PANEL)); | 838 ui::wm::WINDOW_TYPE_PANEL)); |
839 } // namespace internal | 839 } // namespace internal |
840 } // namespace ash | 840 } // namespace ash |
OLD | NEW |