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/immersive_fullscreen_controller.h" | 5 #include "ash/wm/immersive_fullscreen_controller.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ui::SHOW_STATE_FULLSCREEN); | 153 ui::SHOW_STATE_FULLSCREEN); |
154 | 154 |
155 gfx::Size window_size = widget_->GetWindowBoundsInScreen().size(); | 155 gfx::Size window_size = widget_->GetWindowBoundsInScreen().size(); |
156 content_view_ = new views::NativeViewHost(); | 156 content_view_ = new views::NativeViewHost(); |
157 content_view_->SetBounds(0, 0, window_size.width(), window_size.height()); | 157 content_view_->SetBounds(0, 0, window_size.width(), window_size.height()); |
158 widget_->GetContentsView()->AddChildView(content_view_); | 158 widget_->GetContentsView()->AddChildView(content_view_); |
159 | 159 |
160 top_container_ = new views::View(); | 160 top_container_ = new views::View(); |
161 top_container_->SetBounds( | 161 top_container_->SetBounds( |
162 0, 0, window_size.width(), 100); | 162 0, 0, window_size.width(), 100); |
163 top_container_->SetFocusable(true); | 163 top_container_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
164 widget_->GetContentsView()->AddChildView(top_container_); | 164 widget_->GetContentsView()->AddChildView(top_container_); |
165 | 165 |
166 delegate_.reset( | 166 delegate_.reset( |
167 new MockImmersiveFullscreenControllerDelegate(top_container_)); | 167 new MockImmersiveFullscreenControllerDelegate(top_container_)); |
168 controller_.reset(new ImmersiveFullscreenController); | 168 controller_.reset(new ImmersiveFullscreenController); |
169 controller_->Init(delegate_.get(), widget_, top_container_); | 169 controller_->Init(delegate_.get(), widget_, top_container_); |
170 controller_->SetupForTest(); | 170 controller_->SetupForTest(); |
171 | 171 |
172 // The mouse is moved so that it is not over |top_container_| by | 172 // The mouse is moved so that it is not over |top_container_| by |
173 // AshTestBase. | 173 // AshTestBase. |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // Windows. (crbug.com/79493) | 783 // Windows. (crbug.com/79493) |
784 #if !defined(OS_WIN) | 784 #if !defined(OS_WIN) |
785 | 785 |
786 // Test how focus and activation affects whether the top-of-window views are | 786 // Test how focus and activation affects whether the top-of-window views are |
787 // revealed. | 787 // revealed. |
788 TEST_F(ImmersiveFullscreenControllerTest, Focus) { | 788 TEST_F(ImmersiveFullscreenControllerTest, Focus) { |
789 // Add views to the view hierarchy which we will focus and unfocus during the | 789 // Add views to the view hierarchy which we will focus and unfocus during the |
790 // test. | 790 // test. |
791 views::View* child_view = new views::View(); | 791 views::View* child_view = new views::View(); |
792 child_view->SetBounds(0, 0, 10, 10); | 792 child_view->SetBounds(0, 0, 10, 10); |
793 child_view->SetFocusable(true); | 793 child_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
794 top_container()->AddChildView(child_view); | 794 top_container()->AddChildView(child_view); |
795 views::View* unrelated_view = new views::View(); | 795 views::View* unrelated_view = new views::View(); |
796 unrelated_view->SetBounds(0, 100, 10, 10); | 796 unrelated_view->SetBounds(0, 100, 10, 10); |
797 unrelated_view->SetFocusable(true); | 797 unrelated_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
798 top_container()->parent()->AddChildView(unrelated_view); | 798 top_container()->parent()->AddChildView(unrelated_view); |
799 views::FocusManager* focus_manager = | 799 views::FocusManager* focus_manager = |
800 top_container()->GetWidget()->GetFocusManager(); | 800 top_container()->GetWidget()->GetFocusManager(); |
801 | 801 |
802 SetEnabled(true); | 802 SetEnabled(true); |
803 | 803 |
804 // 1) Test that the top-of-window views stay revealed as long as either a | 804 // 1) Test that the top-of-window views stay revealed as long as either a |
805 // |child_view| has focus or the mouse is hovered above the top-of-window | 805 // |child_view| has focus or the mouse is hovered above the top-of-window |
806 // views. | 806 // views. |
807 AttemptReveal(MODALITY_MOUSE); | 807 AttemptReveal(MODALITY_MOUSE); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1053 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
1054 | 1054 |
1055 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1055 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
1056 SetEnabled(false); | 1056 SetEnabled(false); |
1057 window()->SetProperty(aura::client::kShowStateKey, | 1057 window()->SetProperty(aura::client::kShowStateKey, |
1058 ui::SHOW_STATE_NORMAL); | 1058 ui::SHOW_STATE_NORMAL); |
1059 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1059 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
1060 } | 1060 } |
1061 | 1061 |
1062 } // namespase ash | 1062 } // namespase ash |
OLD | NEW |