Chromium Code Reviews| Index: ash/mus/non_client_frame_controller.cc |
| diff --git a/ash/mus/non_client_frame_controller.cc b/ash/mus/non_client_frame_controller.cc |
| index 12b1639fac2dbc2779e8ceb5e1a05eeada3088ce..f7f60e1a0bb66ec4252afbc5cbc20ee1192627e2 100644 |
| --- a/ash/mus/non_client_frame_controller.cc |
| +++ b/ash/mus/non_client_frame_controller.cc |
| @@ -172,7 +172,8 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { |
| WmNativeWidgetAura(views::internal::NativeWidgetDelegate* delegate, |
| aura::WindowManagerClient* window_manager_client, |
| bool remove_standard_frame, |
| - bool enable_immersive) |
| + bool enable_immersive, |
| + mojom::WindowStyle window_style) |
| // The NativeWidget is mirroring the real Widget created in client code. |
| // |is_parallel_widget_in_window_manager| is used to indicate this |
| : views::NativeWidgetAura( |
| @@ -180,9 +181,15 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { |
| true /* is_parallel_widget_in_window_manager */), |
| remove_standard_frame_(remove_standard_frame), |
| enable_immersive_(enable_immersive), |
| + window_style_(window_style), |
| window_manager_client_(window_manager_client) {} |
| ~WmNativeWidgetAura() override {} |
| + void SetHeaderHeight(int height) { |
| + if (custom_frame_view_) |
| + custom_frame_view_->SetHeaderHeight({height}); |
| + } |
| + |
| // views::NativeWidgetAura: |
| views::NonClientFrameView* CreateNonClientFrameView() override { |
| move_event_handler_ = base::MakeUnique<MoveEventHandler>( |
| @@ -198,13 +205,16 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { |
| immersive_delegate_ = |
| base::MakeUnique<ImmersiveFullscreenControllerDelegateMus>(GetWidget(), |
| window); |
| - return new CustomFrameViewMus(GetWidget(), immersive_delegate_.get(), |
| - enable_immersive_); |
| + custom_frame_view_ = |
| + new CustomFrameViewMus(GetWidget(), immersive_delegate_.get(), |
| + enable_immersive_, window_style_); |
| + return custom_frame_view_; |
| } |
| private: |
| const bool remove_standard_frame_; |
| const bool enable_immersive_; |
| + const mojom::WindowStyle window_style_; |
| std::unique_ptr<MoveEventHandler> move_event_handler_; |
| @@ -212,6 +222,9 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { |
| std::unique_ptr<ImmersiveFullscreenControllerDelegateMus> immersive_delegate_; |
| + // Not used for panels or if |remove_standard_frame_| is true. |
| + CustomFrameViewMus* custom_frame_view_ = nullptr; |
|
James Cook
2017/03/02 21:00:00
nit: can you comment who owns this, since it's mad
sky
2017/03/02 21:28:42
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(WmNativeWidgetAura); |
| }; |
| @@ -275,9 +288,11 @@ NonClientFrameController::NonClientFrameController( |
| // (mus) window can have focus. |
| params.delegate = this; |
| params.bounds = bounds; |
| + // The title area leaves notches in the corners, requring translucent windows. |
| + params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| WmNativeWidgetAura* native_widget = new WmNativeWidgetAura( |
| widget_, window_manager_client_, ShouldRemoveStandardFrame(*properties), |
| - ShouldEnableImmersive(*properties)); |
| + ShouldEnableImmersive(*properties), GetWindowStyle(*properties)); |
| window_ = native_widget->GetNativeView(); |
| window_->SetProperty(aura::client::kTopLevelWindowInWM, true); |
| window_->SetProperty(kNonClientFrameControllerKey, this); |
| @@ -314,10 +329,6 @@ NonClientFrameController* NonClientFrameController::Get(aura::Window* window) { |
| // static |
| gfx::Insets NonClientFrameController::GetPreferredClientAreaInsets() { |
| - // TODO(sky): figure out a better way to get this rather than hard coding. |
| - // This value comes from the header (see DefaultHeaderPainter::LayoutHeader, |
| - // which uses the preferred height of the CaptionButtonContainer, which uses |
| - // the height of the close button). |
| return gfx::Insets( |
| GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON).height(), 0, |
| 0, 0); |
| @@ -325,7 +336,6 @@ gfx::Insets NonClientFrameController::GetPreferredClientAreaInsets() { |
| // static |
| int NonClientFrameController::GetMaxTitleBarButtonWidth() { |
| - // TODO(sky): same comment as for GetPreferredClientAreaInsets(). |
| return GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON).width() * |
| 3; |
| } |
| @@ -335,6 +345,8 @@ void NonClientFrameController::SetClientArea( |
| const std::vector<gfx::Rect>& additional_client_areas) { |
| client_area_insets_ = insets; |
| additional_client_areas_ = additional_client_areas; |
| + static_cast<WmNativeWidgetAura*>(widget_->native_widget()) |
| + ->SetHeaderHeight(insets.top()); |
| } |
| NonClientFrameController::~NonClientFrameController() { |