| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_views.h" | 5 #include "views/widget/native_widget_views.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/gfx/compositor/compositor.h" | 8 #include "ui/gfx/compositor/compositor.h" |
| 9 #include "ui/gfx/compositor/layer.h" | |
| 10 #include "ui/gfx/compositor/layer_animator.h" | |
| 11 #include "views/view.h" | 9 #include "views/view.h" |
| 12 #include "views/views_delegate.h" | 10 #include "views/views_delegate.h" |
| 13 #include "views/widget/native_widget_view.h" | 11 #include "views/widget/native_widget_view.h" |
| 14 #include "views/widget/root_view.h" | 12 #include "views/widget/root_view.h" |
| 15 #include "views/widget/window_manager.h" | 13 #include "views/widget/window_manager.h" |
| 16 | 14 |
| 17 #if defined(HAVE_IBUS) | 15 #if defined(HAVE_IBUS) |
| 18 #include "views/ime/input_method_ibus.h" | 16 #include "views/ime/input_method_ibus.h" |
| 19 #else | 17 #else |
| 20 #include "views/ime/mock_input_method.h" | 18 #include "views/ime/mock_input_method.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 restored_bounds_ = view_->bounds(); | 455 restored_bounds_ = view_->bounds(); |
| 458 restored_transform_ = view_->GetTransform(); | 456 restored_transform_ = view_->GetTransform(); |
| 459 } | 457 } |
| 460 | 458 |
| 461 window_state_ = ui::SHOW_STATE_MAXIMIZED; | 459 window_state_ = ui::SHOW_STATE_MAXIMIZED; |
| 462 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); | 460 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); |
| 463 SetBounds(gfx::Rect(gfx::Point(), size)); | 461 SetBounds(gfx::Rect(gfx::Point(), size)); |
| 464 } | 462 } |
| 465 | 463 |
| 466 void NativeWidgetViews::Minimize() { | 464 void NativeWidgetViews::Minimize() { |
| 467 if (view_->layer() && view_->layer()->GetAnimator()->is_animating()) | |
| 468 return; | |
| 469 | |
| 470 gfx::Rect view_bounds = view_->bounds(); | 465 gfx::Rect view_bounds = view_->bounds(); |
| 471 gfx::Rect parent_bounds = view_->parent()->bounds(); | 466 gfx::Rect parent_bounds = view_->parent()->bounds(); |
| 472 | 467 |
| 473 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { | 468 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { |
| 474 restored_bounds_ = view_bounds; | 469 restored_bounds_ = view_bounds; |
| 475 restored_transform_ = view_->GetTransform(); | 470 restored_transform_ = view_->GetTransform(); |
| 476 } | 471 } |
| 477 | 472 |
| 478 float aspect_ratio = static_cast<float>(view_bounds.width()) / | 473 float aspect_ratio = static_cast<float>(view_bounds.width()) / |
| 479 static_cast<float>(view_bounds.height()); | 474 static_cast<float>(view_bounds.height()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 501 | 496 |
| 502 bool NativeWidgetViews::IsMaximized() const { | 497 bool NativeWidgetViews::IsMaximized() const { |
| 503 return window_state_ == ui::SHOW_STATE_MAXIMIZED; | 498 return window_state_ == ui::SHOW_STATE_MAXIMIZED; |
| 504 } | 499 } |
| 505 | 500 |
| 506 bool NativeWidgetViews::IsMinimized() const { | 501 bool NativeWidgetViews::IsMinimized() const { |
| 507 return window_state_ == ui::SHOW_STATE_MINIMIZED; | 502 return window_state_ == ui::SHOW_STATE_MINIMIZED; |
| 508 } | 503 } |
| 509 | 504 |
| 510 void NativeWidgetViews::Restore() { | 505 void NativeWidgetViews::Restore() { |
| 511 if (view_->layer() && view_->layer()->GetAnimator()->is_animating()) | |
| 512 return; | |
| 513 | |
| 514 window_state_ = ui::SHOW_STATE_NORMAL; | 506 window_state_ = ui::SHOW_STATE_NORMAL; |
| 515 view_->SetBoundsRect(restored_bounds_); | 507 view_->SetBoundsRect(restored_bounds_); |
| 516 view_->SetTransform(restored_transform_); | 508 view_->SetTransform(restored_transform_); |
| 517 } | 509 } |
| 518 | 510 |
| 519 void NativeWidgetViews::SetFullscreen(bool fullscreen) { | 511 void NativeWidgetViews::SetFullscreen(bool fullscreen) { |
| 520 NOTIMPLEMENTED(); | 512 NOTIMPLEMENTED(); |
| 521 } | 513 } |
| 522 | 514 |
| 523 bool NativeWidgetViews::IsFullscreen() const { | 515 bool NativeWidgetViews::IsFullscreen() const { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 627 } |
| 636 default: | 628 default: |
| 637 // Everything else falls into standard client event handling. | 629 // Everything else falls into standard client event handling. |
| 638 break; | 630 break; |
| 639 } | 631 } |
| 640 } | 632 } |
| 641 return false; | 633 return false; |
| 642 } | 634 } |
| 643 | 635 |
| 644 } // namespace views | 636 } // namespace views |
| OLD | NEW |