| 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 24 matching lines...) Expand all Loading... |
| 35 : public ImmersiveFullscreenController::Delegate { | 35 : public ImmersiveFullscreenController::Delegate { |
| 36 public: | 36 public: |
| 37 MockImmersiveFullscreenControllerDelegate(views::View* top_container_view) | 37 MockImmersiveFullscreenControllerDelegate(views::View* top_container_view) |
| 38 : top_container_view_(top_container_view), | 38 : top_container_view_(top_container_view), |
| 39 enabled_(false), | 39 enabled_(false), |
| 40 visible_fraction_(1) { | 40 visible_fraction_(1) { |
| 41 } | 41 } |
| 42 virtual ~MockImmersiveFullscreenControllerDelegate() {} | 42 virtual ~MockImmersiveFullscreenControllerDelegate() {} |
| 43 | 43 |
| 44 // ImmersiveFullscreenController::Delegate overrides: | 44 // ImmersiveFullscreenController::Delegate overrides: |
| 45 virtual void OnImmersiveRevealStarted() OVERRIDE { | 45 virtual void OnImmersiveRevealStarted() override { |
| 46 enabled_ = true; | 46 enabled_ = true; |
| 47 visible_fraction_ = 0; | 47 visible_fraction_ = 0; |
| 48 } | 48 } |
| 49 virtual void OnImmersiveRevealEnded() OVERRIDE { | 49 virtual void OnImmersiveRevealEnded() override { |
| 50 visible_fraction_ = 0; | 50 visible_fraction_ = 0; |
| 51 } | 51 } |
| 52 virtual void OnImmersiveFullscreenExited() OVERRIDE { | 52 virtual void OnImmersiveFullscreenExited() override { |
| 53 enabled_ = false; | 53 enabled_ = false; |
| 54 visible_fraction_ = 1; | 54 visible_fraction_ = 1; |
| 55 } | 55 } |
| 56 virtual void SetVisibleFraction(double visible_fraction) OVERRIDE { | 56 virtual void SetVisibleFraction(double visible_fraction) override { |
| 57 visible_fraction_ = visible_fraction; | 57 visible_fraction_ = visible_fraction; |
| 58 } | 58 } |
| 59 virtual std::vector<gfx::Rect> GetVisibleBoundsInScreen() const OVERRIDE { | 59 virtual std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override { |
| 60 std::vector<gfx::Rect> bounds_in_screen; | 60 std::vector<gfx::Rect> bounds_in_screen; |
| 61 bounds_in_screen.push_back(top_container_view_->GetBoundsInScreen()); | 61 bounds_in_screen.push_back(top_container_view_->GetBoundsInScreen()); |
| 62 return bounds_in_screen; | 62 return bounds_in_screen; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool is_enabled() const { | 65 bool is_enabled() const { |
| 66 return enabled_; | 66 return enabled_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 double visible_fraction() const { | 69 double visible_fraction() const { |
| 70 return visible_fraction_; | 70 return visible_fraction_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 views::View* top_container_view_; | 74 views::View* top_container_view_; |
| 75 bool enabled_; | 75 bool enabled_; |
| 76 double visible_fraction_; | 76 double visible_fraction_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(MockImmersiveFullscreenControllerDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(MockImmersiveFullscreenControllerDelegate); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class ConsumeEventHandler : public ui::test::TestEventHandler { | 81 class ConsumeEventHandler : public ui::test::TestEventHandler { |
| 82 public: | 82 public: |
| 83 ConsumeEventHandler() {} | 83 ConsumeEventHandler() {} |
| 84 virtual ~ConsumeEventHandler() {} | 84 virtual ~ConsumeEventHandler() {} |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 virtual void OnEvent(ui::Event* event) OVERRIDE { | 87 virtual void OnEvent(ui::Event* event) override { |
| 88 ui::test::TestEventHandler::OnEvent(event); | 88 ui::test::TestEventHandler::OnEvent(event); |
| 89 if (event->cancelable()) | 89 if (event->cancelable()) |
| 90 event->SetHandled(); | 90 event->SetHandled(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(ConsumeEventHandler); | 93 DISALLOW_COPY_AND_ASSIGN(ConsumeEventHandler); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Access to private data from the controller. | 136 // Access to private data from the controller. |
| 137 bool top_edge_hover_timer_running() const { | 137 bool top_edge_hover_timer_running() const { |
| 138 return controller_->top_edge_hover_timer_.IsRunning(); | 138 return controller_->top_edge_hover_timer_.IsRunning(); |
| 139 } | 139 } |
| 140 int mouse_x_when_hit_top() const { | 140 int mouse_x_when_hit_top() const { |
| 141 return controller_->mouse_x_when_hit_top_in_screen_; | 141 return controller_->mouse_x_when_hit_top_in_screen_; |
| 142 } | 142 } |
| 143 | 143 |
| 144 // ash::test::AshTestBase overrides: | 144 // ash::test::AshTestBase overrides: |
| 145 virtual void SetUp() OVERRIDE { | 145 virtual void SetUp() override { |
| 146 ash::test::AshTestBase::SetUp(); | 146 ash::test::AshTestBase::SetUp(); |
| 147 | 147 |
| 148 widget_ = new views::Widget(); | 148 widget_ = new views::Widget(); |
| 149 views::Widget::InitParams params; | 149 views::Widget::InitParams params; |
| 150 params.context = CurrentContext(); | 150 params.context = CurrentContext(); |
| 151 widget_->Init(params); | 151 widget_->Init(params); |
| 152 widget_->Show(); | 152 widget_->Show(); |
| 153 | 153 |
| 154 window()->SetProperty(aura::client::kShowStateKey, | 154 window()->SetProperty(aura::client::kShowStateKey, |
| 155 ui::SHOW_STATE_FULLSCREEN); | 155 ui::SHOW_STATE_FULLSCREEN); |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1062 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 1063 | 1063 |
| 1064 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1064 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1065 SetEnabled(false); | 1065 SetEnabled(false); |
| 1066 window()->SetProperty(aura::client::kShowStateKey, | 1066 window()->SetProperty(aura::client::kShowStateKey, |
| 1067 ui::SHOW_STATE_NORMAL); | 1067 ui::SHOW_STATE_NORMAL); |
| 1068 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1068 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 } // namespase ash | 1071 } // namespase ash |
| OLD | NEW |