| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/wm/bridge/wm_window_mus.h" | 5 #include "mash/wm/bridge/wm_window_mus.h" |
| 6 | 6 |
| 7 #include "ash/wm/common/container_finder.h" | 7 #include "ash/wm/common/container_finder.h" |
| 8 #include "ash/wm/common/window_state.h" | 8 #include "ash/wm/common/window_state.h" |
| 9 #include "ash/wm/common/wm_layout_manager.h" | 9 #include "ash/wm/common/wm_layout_manager.h" |
| 10 #include "ash/wm/common/wm_window_observer.h" | 10 #include "ash/wm/common/wm_window_observer.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 ash::wm::WmRootWindowController* WmWindowMus::GetRootWindowController() { | 153 ash::wm::WmRootWindowController* WmWindowMus::GetRootWindowController() { |
| 154 return GetRootWindowControllerMus(); | 154 return GetRootWindowControllerMus(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 ash::wm::WmGlobals* WmWindowMus::GetGlobals() const { | 157 ash::wm::WmGlobals* WmWindowMus::GetGlobals() const { |
| 158 return WmGlobalsMus::Get(); | 158 return WmGlobalsMus::Get(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 base::string16 WmWindowMus::GetTitle() const { |
| 162 return GetWindowTitle(window_); |
| 163 } |
| 164 |
| 161 void WmWindowMus::SetShellWindowId(int id) { | 165 void WmWindowMus::SetShellWindowId(int id) { |
| 162 shell_window_id_ = id; | 166 shell_window_id_ = id; |
| 163 } | 167 } |
| 164 | 168 |
| 165 int WmWindowMus::GetShellWindowId() const { | 169 int WmWindowMus::GetShellWindowId() const { |
| 166 return shell_window_id_; | 170 return shell_window_id_; |
| 167 } | 171 } |
| 168 | 172 |
| 169 ui::wm::WindowType WmWindowMus::GetType() const { | 173 ui::wm::WindowType WmWindowMus::GetType() const { |
| 170 return GetWmWindowType(window_); | 174 return GetWmWindowType(window_); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 237 |
| 234 gfx::Size WmWindowMus::GetMinimumSize() const { | 238 gfx::Size WmWindowMus::GetMinimumSize() const { |
| 235 return widget_ ? widget_->GetMinimumSize() : gfx::Size(); | 239 return widget_ ? widget_->GetMinimumSize() : gfx::Size(); |
| 236 } | 240 } |
| 237 | 241 |
| 238 gfx::Size WmWindowMus::GetMaximumSize() const { | 242 gfx::Size WmWindowMus::GetMaximumSize() const { |
| 239 return widget_ ? widget_->GetMaximumSize() : gfx::Size(); | 243 return widget_ ? widget_->GetMaximumSize() : gfx::Size(); |
| 240 } | 244 } |
| 241 | 245 |
| 242 bool WmWindowMus::GetTargetVisibility() const { | 246 bool WmWindowMus::GetTargetVisibility() const { |
| 247 // TODO: need animation support: http://crbug.com/615087. |
| 243 NOTIMPLEMENTED(); | 248 NOTIMPLEMENTED(); |
| 244 return window_->visible(); | 249 return window_->visible(); |
| 245 } | 250 } |
| 246 | 251 |
| 247 bool WmWindowMus::IsVisible() const { | 252 bool WmWindowMus::IsVisible() const { |
| 248 return window_->visible(); | 253 return window_->visible(); |
| 249 } | 254 } |
| 250 | 255 |
| 256 void WmWindowMus::SetOpacity(float opacity) { |
| 257 window_->SetOpacity(opacity); |
| 258 } |
| 259 |
| 260 float WmWindowMus::GetTargetOpacity() const { |
| 261 // TODO: need animation support: http://crbug.com/615087. |
| 262 return window_->opacity(); |
| 263 } |
| 264 |
| 265 void WmWindowMus::SetTransform(const gfx::Transform& transform) { |
| 266 // TODO: mus needs to support transforms: http://crbug.com/615089. |
| 267 NOTIMPLEMENTED(); |
| 268 } |
| 269 |
| 270 gfx::Transform WmWindowMus::GetTargetTransform() const { |
| 271 // TODO: need animation support: http://crbug.com/615087. |
| 272 return gfx::Transform(); |
| 273 } |
| 274 |
| 251 bool WmWindowMus::IsSystemModal() const { | 275 bool WmWindowMus::IsSystemModal() const { |
| 252 NOTIMPLEMENTED(); | 276 NOTIMPLEMENTED(); |
| 253 return false; | 277 return false; |
| 254 } | 278 } |
| 255 | 279 |
| 256 bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) { | 280 bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) { |
| 257 switch (key) { | 281 switch (key) { |
| 258 case ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUDARY: | 282 case ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUDARY: |
| 259 NOTIMPLEMENTED(); | 283 NOTIMPLEMENTED(); |
| 260 return true; | 284 return true; |
| 261 | 285 |
| 262 case ash::wm::WmWindowProperty::ALWAYS_ON_TOP: | 286 case ash::wm::WmWindowProperty::ALWAYS_ON_TOP: |
| 263 return IsAlwaysOnTop(); | 287 return IsAlwaysOnTop(); |
| 264 | 288 |
| 265 default: | 289 default: |
| 266 NOTREACHED(); | 290 NOTREACHED(); |
| 267 break; | 291 break; |
| 268 } | 292 } |
| 269 | 293 |
| 270 NOTREACHED(); | 294 NOTREACHED(); |
| 271 return false; | 295 return false; |
| 272 } | 296 } |
| 273 | 297 |
| 274 int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) { | 298 int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) { |
| 275 if (key == ash::wm::WmWindowProperty::SHELF_ID) { | 299 if (key == ash::wm::WmWindowProperty::SHELF_ID) { |
| 276 NOTIMPLEMENTED(); | 300 NOTIMPLEMENTED(); |
| 277 return 0; | 301 return 0; |
| 278 } | 302 } |
| 279 | 303 |
| 304 if (key == ash::wm::WmWindowProperty::TOP_VIEW_INSET) { |
| 305 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. |
| 306 NOTIMPLEMENTED(); |
| 307 return 0; |
| 308 } |
| 309 |
| 280 NOTREACHED(); | 310 NOTREACHED(); |
| 281 return 0; | 311 return 0; |
| 282 } | 312 } |
| 283 | 313 |
| 284 const ash::wm::WindowState* WmWindowMus::GetWindowState() const { | 314 const ash::wm::WindowState* WmWindowMus::GetWindowState() const { |
| 285 return window_state_.get(); | 315 return window_state_.get(); |
| 286 } | 316 } |
| 287 | 317 |
| 288 ash::wm::WmWindow* WmWindowMus::GetToplevelWindow() { | 318 ash::wm::WmWindow* WmWindowMus::GetToplevelWindow() { |
| 289 return WmGlobalsMus::GetToplevelAncestor(window_); | 319 return WmGlobalsMus::GetToplevelAncestor(window_); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 319 layout_manager_adapter_.reset(); | 349 layout_manager_adapter_.reset(); |
| 320 } | 350 } |
| 321 } | 351 } |
| 322 | 352 |
| 323 ash::wm::WmLayoutManager* WmWindowMus::GetLayoutManager() { | 353 ash::wm::WmLayoutManager* WmWindowMus::GetLayoutManager() { |
| 324 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager() | 354 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager() |
| 325 : nullptr; | 355 : nullptr; |
| 326 } | 356 } |
| 327 | 357 |
| 328 void WmWindowMus::SetVisibilityAnimationType(int type) { | 358 void WmWindowMus::SetVisibilityAnimationType(int type) { |
| 359 // TODO: need animation support: http://crbug.com/615087. |
| 329 NOTIMPLEMENTED(); | 360 NOTIMPLEMENTED(); |
| 330 } | 361 } |
| 331 | 362 |
| 332 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) { | 363 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) { |
| 364 // TODO: need animation support: http://crbug.com/615087. |
| 365 NOTIMPLEMENTED(); |
| 366 } |
| 367 |
| 368 void WmWindowMus::SetVisibilityAnimationTransition( |
| 369 ::wm::WindowVisibilityAnimationTransition transition) { |
| 370 // TODO: need animation support: http://crbug.com/615087. |
| 333 NOTIMPLEMENTED(); | 371 NOTIMPLEMENTED(); |
| 334 } | 372 } |
| 335 | 373 |
| 336 void WmWindowMus::Animate(::wm::WindowAnimationType type) { | 374 void WmWindowMus::Animate(::wm::WindowAnimationType type) { |
| 375 // TODO: need animation support: http://crbug.com/615087. |
| 337 NOTIMPLEMENTED(); | 376 NOTIMPLEMENTED(); |
| 338 } | 377 } |
| 339 | 378 |
| 379 void WmWindowMus::StopAnimatingProperty( |
| 380 ui::LayerAnimationElement::AnimatableProperty property) { |
| 381 // TODO: need animation support: http://crbug.com/615087. |
| 382 NOTIMPLEMENTED(); |
| 383 } |
| 384 |
| 340 void WmWindowMus::SetBounds(const gfx::Rect& bounds) { | 385 void WmWindowMus::SetBounds(const gfx::Rect& bounds) { |
| 341 if (window_->parent()) { | 386 if (window_->parent()) { |
| 342 WmWindowMus* parent = WmWindowMus::Get(window_->parent()); | 387 WmWindowMus* parent = WmWindowMus::Get(window_->parent()); |
| 343 if (parent->layout_manager_adapter_) { | 388 if (parent->layout_manager_adapter_) { |
| 344 parent->layout_manager_adapter_->layout_manager()->SetChildBounds(this, | 389 parent->layout_manager_adapter_->layout_manager()->SetChildBounds(this, |
| 345 bounds); | 390 bounds); |
| 346 return; | 391 return; |
| 347 } | 392 } |
| 348 } | 393 } |
| 349 SetBoundsDirect(bounds); | 394 SetBoundsDirect(bounds); |
| 350 } | 395 } |
| 351 | 396 |
| 352 void WmWindowMus::SetBoundsWithTransitionDelay(const gfx::Rect& bounds, | 397 void WmWindowMus::SetBoundsWithTransitionDelay(const gfx::Rect& bounds, |
| 353 base::TimeDelta delta) { | 398 base::TimeDelta delta) { |
| 399 // TODO: need animation support: http://crbug.com/615087. |
| 354 NOTIMPLEMENTED(); | 400 NOTIMPLEMENTED(); |
| 355 SetBounds(bounds); | 401 SetBounds(bounds); |
| 356 } | 402 } |
| 357 | 403 |
| 358 void WmWindowMus::SetBoundsDirect(const gfx::Rect& bounds) { | 404 void WmWindowMus::SetBoundsDirect(const gfx::Rect& bounds) { |
| 359 window_->SetBounds(bounds); | 405 window_->SetBounds(bounds); |
| 360 SnapToPixelBoundaryIfNecessary(); | 406 SnapToPixelBoundaryIfNecessary(); |
| 361 } | 407 } |
| 362 | 408 |
| 363 void WmWindowMus::SetBoundsDirectAnimated(const gfx::Rect& bounds) { | 409 void WmWindowMus::SetBoundsDirectAnimated(const gfx::Rect& bounds) { |
| 410 // TODO: need animation support: http://crbug.com/615087. |
| 364 NOTIMPLEMENTED(); | 411 NOTIMPLEMENTED(); |
| 365 SetBoundsDirect(bounds); | 412 SetBoundsDirect(bounds); |
| 366 } | 413 } |
| 367 | 414 |
| 368 void WmWindowMus::SetBoundsDirectCrossFade(const gfx::Rect& bounds) { | 415 void WmWindowMus::SetBoundsDirectCrossFade(const gfx::Rect& bounds) { |
| 416 // TODO: need animation support: http://crbug.com/615087. |
| 369 NOTIMPLEMENTED(); | 417 NOTIMPLEMENTED(); |
| 370 SetBoundsDirect(bounds); | 418 SetBoundsDirect(bounds); |
| 371 } | 419 } |
| 372 | 420 |
| 373 void WmWindowMus::SetBoundsInScreen(const gfx::Rect& bounds_in_screen, | 421 void WmWindowMus::SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
| 374 const display::Display& dst_display) { | 422 const display::Display& dst_display) { |
| 375 // TODO(sky): need to find WmRootWindowControllerMus for dst_display and | 423 // TODO(sky): need to find WmRootWindowControllerMus for dst_display and |
| 376 // convert. | 424 // convert. |
| 377 NOTIMPLEMENTED(); | 425 NOTIMPLEMENTED(); |
| 378 SetBounds(ConvertRectFromScreen(bounds_in_screen)); | 426 SetBounds(ConvertRectFromScreen(bounds_in_screen)); |
| 379 } | 427 } |
| 380 | 428 |
| 381 gfx::Rect WmWindowMus::GetBoundsInScreen() const { | 429 gfx::Rect WmWindowMus::GetBoundsInScreen() const { |
| 382 return ConvertRectToScreen(gfx::Rect(window_->bounds().size())); | 430 return ConvertRectToScreen(gfx::Rect(window_->bounds().size())); |
| 383 } | 431 } |
| 384 | 432 |
| 385 const gfx::Rect& WmWindowMus::GetBounds() const { | 433 const gfx::Rect& WmWindowMus::GetBounds() const { |
| 386 return window_->bounds(); | 434 return window_->bounds(); |
| 387 } | 435 } |
| 388 | 436 |
| 389 gfx::Rect WmWindowMus::GetTargetBounds() { | 437 gfx::Rect WmWindowMus::GetTargetBounds() { |
| 438 // TODO: need animation support: http://crbug.com/615087. |
| 390 NOTIMPLEMENTED(); | 439 NOTIMPLEMENTED(); |
| 391 return window_->bounds(); | 440 return window_->bounds(); |
| 392 } | 441 } |
| 393 | 442 |
| 394 void WmWindowMus::ClearRestoreBounds() { | 443 void WmWindowMus::ClearRestoreBounds() { |
| 395 restore_bounds_in_screen_.reset(); | 444 restore_bounds_in_screen_.reset(); |
| 396 } | 445 } |
| 397 | 446 |
| 398 void WmWindowMus::SetRestoreBoundsInScreen(const gfx::Rect& bounds) { | 447 void WmWindowMus::SetRestoreBoundsInScreen(const gfx::Rect& bounds) { |
| 399 restore_bounds_in_screen_.reset(new gfx::Rect(bounds)); | 448 restore_bounds_in_screen_.reset(new gfx::Rect(bounds)); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 538 } |
| 490 | 539 |
| 491 void WmWindowMus::Hide() { | 540 void WmWindowMus::Hide() { |
| 492 window_->SetVisible(false); | 541 window_->SetVisible(false); |
| 493 } | 542 } |
| 494 | 543 |
| 495 void WmWindowMus::Show() { | 544 void WmWindowMus::Show() { |
| 496 window_->SetVisible(true); | 545 window_->SetVisible(true); |
| 497 } | 546 } |
| 498 | 547 |
| 548 void WmWindowMus::CloseWidget() { |
| 549 DCHECK(widget_); |
| 550 // Allow the client to service the close request for remote widgets. |
| 551 if (widget_creation_type_ == WidgetCreationType::FOR_CLIENT) |
| 552 window_->RequestClose(); |
| 553 else |
| 554 widget_->Close(); |
| 555 } |
| 556 |
| 499 bool WmWindowMus::IsFocused() const { | 557 bool WmWindowMus::IsFocused() const { |
| 500 return window_->HasFocus(); | 558 return window_->HasFocus(); |
| 501 } | 559 } |
| 502 | 560 |
| 503 bool WmWindowMus::IsActive() const { | 561 bool WmWindowMus::IsActive() const { |
| 504 mus::Window* focused = window_->connection()->GetFocusedWindow(); | 562 mus::Window* focused = window_->connection()->GetFocusedWindow(); |
| 505 return focused && window_->Contains(focused); | 563 return focused && window_->Contains(focused); |
| 506 } | 564 } |
| 507 | 565 |
| 508 void WmWindowMus::Activate() { | 566 void WmWindowMus::Activate() { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 673 OnWindowBoundsChanged(this, old_bounds, new_bounds)); |
| 616 } | 674 } |
| 617 | 675 |
| 618 void WmWindowMus::OnWindowDestroying(mus::Window* window) { | 676 void WmWindowMus::OnWindowDestroying(mus::Window* window) { |
| 619 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 677 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 620 OnWindowDestroying(this)); | 678 OnWindowDestroying(this)); |
| 621 } | 679 } |
| 622 | 680 |
| 623 } // namespace wm | 681 } // namespace wm |
| 624 } // namespace mash | 682 } // namespace mash |
| OLD | NEW |