| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/non_client_frame_controller.h" | 5 #include "ash/mus/non_client_frame_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/aura/wm_window_aura.h" | |
| 14 #include "ash/common/ash_constants.h" | 13 #include "ash/common/ash_constants.h" |
| 15 #include "ash/common/ash_layout_constants.h" | 14 #include "ash/common/ash_layout_constants.h" |
| 16 #include "ash/common/frame/custom_frame_view_ash.h" | 15 #include "ash/common/frame/custom_frame_view_ash.h" |
| 17 #include "ash/common/wm/panels/panel_frame_view.h" | 16 #include "ash/common/wm/panels/panel_frame_view.h" |
| 17 #include "ash/common/wm_window.h" |
| 18 #include "ash/mus/frame/custom_frame_view_mus.h" | 18 #include "ash/mus/frame/custom_frame_view_mus.h" |
| 19 #include "ash/mus/frame/detached_title_area_renderer.h" | 19 #include "ash/mus/frame/detached_title_area_renderer.h" |
| 20 #include "ash/mus/move_event_handler.h" | 20 #include "ash/mus/move_event_handler.h" |
| 21 #include "ash/mus/property_util.h" | 21 #include "ash/mus/property_util.h" |
| 22 #include "ash/mus/shadow.h" | 22 #include "ash/mus/shadow.h" |
| 23 #include "ash/mus/window_manager.h" | 23 #include "ash/mus/window_manager.h" |
| 24 #include "ash/mus/window_properties.h" | 24 #include "ash/mus/window_properties.h" |
| 25 #include "ash/shared/immersive_fullscreen_controller_delegate.h" | 25 #include "ash/shared/immersive_fullscreen_controller_delegate.h" |
| 26 #include "ash/wm/window_properties.h" | 26 #include "ash/wm/window_properties.h" |
| 27 #include "base/macros.h" | 27 #include "base/macros.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Clip the bounds of the title area to that of the |frame_window_|. | 114 // Clip the bounds of the title area to that of the |frame_window_|. |
| 115 gfx::Rect visible_bounds = title_area_window->bounds(); | 115 gfx::Rect visible_bounds = title_area_window->bounds(); |
| 116 visible_bounds.Intersect(frame_window_->bounds()); | 116 visible_bounds.Intersect(frame_window_->bounds()); |
| 117 // The intersection is in the coordinates of |title_area_window|'s parent, | 117 // The intersection is in the coordinates of |title_area_window|'s parent, |
| 118 // convert to be in |title_area_window| and then to screen. | 118 // convert to be in |title_area_window| and then to screen. |
| 119 visible_bounds -= title_area_window->bounds().origin().OffsetFromOrigin(); | 119 visible_bounds -= title_area_window->bounds().origin().OffsetFromOrigin(); |
| 120 // TODO: this needs updating when parent of |title_area_window| is changed, | 120 // TODO: this needs updating when parent of |title_area_window| is changed, |
| 121 // DCHECK is to ensure when parent changes this code is updated. | 121 // DCHECK is to ensure when parent changes this code is updated. |
| 122 // http://crbug.com/640392. | 122 // http://crbug.com/640392. |
| 123 DCHECK_EQ(frame_window_->parent(), title_area_window->parent()); | 123 DCHECK_EQ(frame_window_->parent(), title_area_window->parent()); |
| 124 result.push_back(ash::WmWindowAura::Get(title_area_window) | 124 result.push_back( |
| 125 ->ConvertRectToScreen(visible_bounds)); | 125 WmWindow::Get(title_area_window)->ConvertRectToScreen(visible_bounds)); |
| 126 return result; | 126 return result; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // DetachedTitleAreaRendererHost: | 129 // DetachedTitleAreaRendererHost: |
| 130 void OnDetachedTitleAreaRendererDestroyed( | 130 void OnDetachedTitleAreaRendererDestroyed( |
| 131 DetachedTitleAreaRenderer* renderer) override { | 131 DetachedTitleAreaRenderer* renderer) override { |
| 132 title_area_renderer_ = nullptr; | 132 title_area_renderer_ = nullptr; |
| 133 } | 133 } |
| 134 | 134 |
| 135 private: | 135 private: |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // NativeWidgetAura resets the show state from |params|, so we need to update | 323 // NativeWidgetAura resets the show state from |params|, so we need to update |
| 324 // |params|. | 324 // |params|. |
| 325 params.show_state = window_->GetProperty(aura::client::kShowStateKey); | 325 params.show_state = window_->GetProperty(aura::client::kShowStateKey); |
| 326 widget_->Init(params); | 326 widget_->Init(params); |
| 327 did_init_native_widget_ = true; | 327 did_init_native_widget_ = true; |
| 328 | 328 |
| 329 widget_->ShowInactive(); | 329 widget_->ShowInactive(); |
| 330 | 330 |
| 331 const int shadow_inset = | 331 const int shadow_inset = |
| 332 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); | 332 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); |
| 333 ash::WmWindowAura* wm_window = ash::WmWindowAura::Get(window_); | 333 WmWindow* wm_window = WmWindow::Get(window_); |
| 334 const gfx::Insets extended_hit_region = | 334 const gfx::Insets extended_hit_region = |
| 335 wm_window->ShouldUseExtendedHitRegion() ? GetExtendedHitRegion() | 335 wm_window->ShouldUseExtendedHitRegion() ? GetExtendedHitRegion() |
| 336 : gfx::Insets(); | 336 : gfx::Insets(); |
| 337 window_manager_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 337 window_manager_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 338 window_, gfx::Vector2d(shadow_inset, shadow_inset), extended_hit_region); | 338 window_, gfx::Vector2d(shadow_inset, shadow_inset), extended_hit_region); |
| 339 } | 339 } |
| 340 | 340 |
| 341 // static | 341 // static |
| 342 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) { | 342 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) { |
| 343 return window->GetProperty(kNonClientFrameControllerKey); | 343 return window->GetProperty(kNonClientFrameControllerKey); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 base::string16 title = *window_->GetProperty(aura::client::kTitleKey); | 388 base::string16 title = *window_->GetProperty(aura::client::kTitleKey); |
| 389 | 389 |
| 390 if (window_->GetProperty(kWindowIsJanky)) | 390 if (window_->GetProperty(kWindowIsJanky)) |
| 391 title += base::ASCIIToUTF16(" !! Not responding !!"); | 391 title += base::ASCIIToUTF16(" !! Not responding !!"); |
| 392 | 392 |
| 393 return title; | 393 return title; |
| 394 } | 394 } |
| 395 | 395 |
| 396 bool NonClientFrameController::CanResize() const { | 396 bool NonClientFrameController::CanResize() const { |
| 397 return window_ && ash::WmWindowAura::Get(window_)->CanResize(); | 397 return window_ && WmWindow::Get(window_)->CanResize(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool NonClientFrameController::CanMaximize() const { | 400 bool NonClientFrameController::CanMaximize() const { |
| 401 return window_ && ash::WmWindowAura::Get(window_)->CanMaximize(); | 401 return window_ && WmWindow::Get(window_)->CanMaximize(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 bool NonClientFrameController::CanMinimize() const { | 404 bool NonClientFrameController::CanMinimize() const { |
| 405 return window_ && ash::WmWindowAura::Get(window_)->CanMinimize(); | 405 return window_ && WmWindow::Get(window_)->CanMinimize(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 bool NonClientFrameController::ShouldShowWindowTitle() const { | 408 bool NonClientFrameController::ShouldShowWindowTitle() const { |
| 409 // Only draw the title if the client hasn't declared any additional client | 409 // Only draw the title if the client hasn't declared any additional client |
| 410 // areas which might conflict with it. | 410 // areas which might conflict with it. |
| 411 return window_ && additional_client_areas_.empty(); | 411 return window_ && additional_client_areas_.empty(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 views::ClientView* NonClientFrameController::CreateClientView( | 414 views::ClientView* NonClientFrameController::CreateClientView( |
| 415 views::Widget* widget) { | 415 views::Widget* widget) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 void NonClientFrameController::OnWindowDestroyed(aura::Window* window) { | 453 void NonClientFrameController::OnWindowDestroyed(aura::Window* window) { |
| 454 window_->RemoveObserver(this); | 454 window_->RemoveObserver(this); |
| 455 window_ = nullptr; | 455 window_ = nullptr; |
| 456 } | 456 } |
| 457 | 457 |
| 458 } // namespace mus | 458 } // namespace mus |
| 459 } // namespace ash | 459 } // namespace ash |
| OLD | NEW |