| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/frame/custom_frame_view_ash.h" | 5 #include "ash/common/frame/custom_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 11 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 12 #include "ash/common/frame/frame_border_hit_test.h" | 12 #include "ash/common/frame/frame_border_hit_test.h" |
| 13 #include "ash/common/frame/header_view.h" | 13 #include "ash/common/frame/header_view.h" |
| 14 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller.h" | |
| 15 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | |
| 16 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm/window_state_delegate.h" | 15 #include "ash/common/wm/window_state_delegate.h" |
| 18 #include "ash/common/wm/window_state_observer.h" | 16 #include "ash/common/wm/window_state_observer.h" |
| 19 #include "ash/common/wm_lookup.h" | 17 #include "ash/common/wm_lookup.h" |
| 20 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 21 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
| 22 #include "ash/common/wm_window_observer.h" | 20 #include "ash/common/wm_window_observer.h" |
| 23 #include "ash/common/wm_window_property.h" | 21 #include "ash/common/wm_window_property.h" |
| 22 #include "ash/shared/immersive_fullscreen_controller.h" |
| 23 #include "ash/shared/immersive_fullscreen_controller_delegate.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
| 25 #include "ui/gfx/geometry/rect_conversions.h" | 25 #include "ui/gfx/geometry/rect_conversions.h" |
| 26 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| 27 #include "ui/views/view.h" | 27 #include "ui/views/view.h" |
| 28 #include "ui/views/view_targeter.h" | 28 #include "ui/views/view_targeter.h" |
| 29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 30 #include "ui/views/widget/widget_delegate.h" | 30 #include "ui/views/widget/widget_delegate.h" |
| 31 | 31 |
| 32 namespace ash { | 32 namespace ash { |
| 33 | 33 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 private: | 72 private: |
| 73 // Overridden from wm::WindowStateDelegate: | 73 // Overridden from wm::WindowStateDelegate: |
| 74 bool ToggleFullscreen(wm::WindowState* window_state) override { | 74 bool ToggleFullscreen(wm::WindowState* window_state) override { |
| 75 bool enter_fullscreen = !window_state->IsFullscreen(); | 75 bool enter_fullscreen = !window_state->IsFullscreen(); |
| 76 if (enter_fullscreen) | 76 if (enter_fullscreen) |
| 77 window_state_->window()->SetShowState(ui::SHOW_STATE_FULLSCREEN); | 77 window_state_->window()->SetShowState(ui::SHOW_STATE_FULLSCREEN); |
| 78 else | 78 else |
| 79 window_state->Restore(); | 79 window_state->Restore(); |
| 80 if (immersive_fullscreen_controller_) { | 80 if (immersive_fullscreen_controller_) { |
| 81 immersive_fullscreen_controller_->SetEnabled( | 81 immersive_fullscreen_controller_->SetEnabled( |
| 82 WmImmersiveFullscreenController::WINDOW_TYPE_OTHER, enter_fullscreen); | 82 ImmersiveFullscreenController::WINDOW_TYPE_OTHER, enter_fullscreen); |
| 83 } | 83 } |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 // Overridden from WmWindowObserver: | 86 // Overridden from WmWindowObserver: |
| 87 void OnWindowDestroying(WmWindow* window) override { | 87 void OnWindowDestroying(WmWindow* window) override { |
| 88 window_state_->RemoveObserver(this); | 88 window_state_->RemoveObserver(this); |
| 89 window->RemoveObserver(this); | 89 window->RemoveObserver(this); |
| 90 window_state_ = nullptr; | 90 window_state_ = nullptr; |
| 91 } | 91 } |
| 92 // Overridden from wm::WindowStateObserver: | 92 // Overridden from wm::WindowStateObserver: |
| 93 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 93 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| 94 wm::WindowStateType old_type) override { | 94 wm::WindowStateType old_type) override { |
| 95 if (!window_state->IsFullscreen() && !window_state->IsMinimized() && | 95 if (!window_state->IsFullscreen() && !window_state->IsMinimized() && |
| 96 immersive_fullscreen_controller_ && | 96 immersive_fullscreen_controller_ && |
| 97 immersive_fullscreen_controller_->IsEnabled()) { | 97 immersive_fullscreen_controller_->IsEnabled()) { |
| 98 immersive_fullscreen_controller_->SetEnabled( | 98 immersive_fullscreen_controller_->SetEnabled( |
| 99 WmImmersiveFullscreenController::WINDOW_TYPE_OTHER, false); | 99 ImmersiveFullscreenController::WINDOW_TYPE_OTHER, false); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 wm::WindowState* window_state_; | 103 wm::WindowState* window_state_; |
| 104 std::unique_ptr<WmImmersiveFullscreenController> | 104 std::unique_ptr<ImmersiveFullscreenController> |
| 105 immersive_fullscreen_controller_; | 105 immersive_fullscreen_controller_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); | 107 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 /////////////////////////////////////////////////////////////////////////////// | 112 /////////////////////////////////////////////////////////////////////////////// |
| 113 // CustomFrameViewAsh::OverlayView | 113 // CustomFrameViewAsh::OverlayView |
| 114 | 114 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 wm::WindowState* window_state = frame_window->GetWindowState(); | 192 wm::WindowState* window_state = frame_window->GetWindowState(); |
| 193 if (!window_state->HasDelegate()) { | 193 if (!window_state->HasDelegate()) { |
| 194 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( | 194 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( |
| 195 new CustomFrameViewAshWindowStateDelegate(window_state, this))); | 195 new CustomFrameViewAshWindowStateDelegate(window_state, this))); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 CustomFrameViewAsh::~CustomFrameViewAsh() {} | 199 CustomFrameViewAsh::~CustomFrameViewAsh() {} |
| 200 | 200 |
| 201 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( | 201 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( |
| 202 WmImmersiveFullscreenController* immersive_fullscreen_controller) { | 202 ImmersiveFullscreenController* immersive_fullscreen_controller) { |
| 203 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); | 203 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, | 206 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, |
| 207 SkColor inactive_frame_color) { | 207 SkColor inactive_frame_color) { |
| 208 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); | 208 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); |
| 209 } | 209 } |
| 210 | 210 |
| 211 //////////////////////////////////////////////////////////////////////////////// | 211 //////////////////////////////////////////////////////////////////////////////// |
| 212 // CustomFrameViewAsh, views::NonClientFrameView overrides: | 212 // CustomFrameViewAsh, views::NonClientFrameView overrides: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 FrameCaptionButtonContainerView* | 340 FrameCaptionButtonContainerView* |
| 341 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { | 341 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { |
| 342 return header_view_->caption_button_container(); | 342 return header_view_->caption_button_container(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 345 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 346 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 346 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace ash | 349 } // namespace ash |
| OLD | NEW |