| 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/common/shelf/shelf_types.h" | 7 #include "ash/common/shelf/shelf_types.h" |
| 8 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | 8 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 11 #include "ash/display/mouse_cursor_event_filter.h" | 11 #include "ash/display/mouse_cursor_event_filter.h" |
| 12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
| 17 #include "ash/test/immersive_fullscreen_controller_test_api.h" |
| 17 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/client/cursor_client.h" | 20 #include "ui/aura/client/cursor_client.h" |
| 20 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 21 #include "ui/aura/test/test_window_delegate.h" | 22 #include "ui/aura/test/test_window_delegate.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_event_dispatcher.h" | 24 #include "ui/aura/window_event_dispatcher.h" |
| 24 #include "ui/display/manager/display_layout.h" | 25 #include "ui/display/manager/display_layout.h" |
| 25 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 26 #include "ui/events/test/event_generator.h" | 27 #include "ui/events/test/event_generator.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 top_container_ = new views::View(); | 160 top_container_ = new views::View(); |
| 160 top_container_->SetBounds(0, 0, window_size.width(), 100); | 161 top_container_->SetBounds(0, 0, window_size.width(), 100); |
| 161 top_container_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); | 162 top_container_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 162 widget_->GetContentsView()->AddChildView(top_container_); | 163 widget_->GetContentsView()->AddChildView(top_container_); |
| 163 | 164 |
| 164 delegate_.reset( | 165 delegate_.reset( |
| 165 new MockImmersiveFullscreenControllerDelegate(top_container_)); | 166 new MockImmersiveFullscreenControllerDelegate(top_container_)); |
| 166 controller_.reset(new ImmersiveFullscreenController); | 167 controller_.reset(new ImmersiveFullscreenController); |
| 167 controller_->Init(delegate_.get(), widget_, top_container_); | 168 controller_->Init(delegate_.get(), widget_, top_container_); |
| 168 controller_->SetupForTest(); | 169 ImmersiveFullscreenControllerTestApi(controller_.get()).SetupForTest(); |
| 169 | 170 |
| 170 // The mouse is moved so that it is not over |top_container_| by | 171 // The mouse is moved so that it is not over |top_container_| by |
| 171 // AshTestBase. | 172 // AshTestBase. |
| 172 } | 173 } |
| 173 | 174 |
| 174 // Enables / disables immersive fullscreen. | 175 // Enables / disables immersive fullscreen. |
| 175 void SetEnabled(bool enabled) { | 176 void SetEnabled(bool enabled) { |
| 176 controller_->SetEnabled(ImmersiveFullscreenController::WINDOW_TYPE_OTHER, | 177 controller_->SetEnabled(ImmersiveFullscreenController::WINDOW_TYPE_OTHER, |
| 177 enabled); | 178 enabled); |
| 178 } | 179 } |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 SetEnabled(true); | 1048 SetEnabled(true); |
| 1048 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1049 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1049 | 1050 |
| 1050 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1051 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1051 SetEnabled(false); | 1052 SetEnabled(false); |
| 1052 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1053 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 1053 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1054 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1054 } | 1055 } |
| 1055 | 1056 |
| 1056 } // namespase ash | 1057 } // namespase ash |
| OLD | NEW |