| 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" |
| 9 #include "views/view.h" | 11 #include "views/view.h" |
| 10 #include "views/views_delegate.h" | 12 #include "views/views_delegate.h" |
| 11 #include "views/widget/native_widget_view.h" | 13 #include "views/widget/native_widget_view.h" |
| 12 #include "views/widget/root_view.h" | 14 #include "views/widget/root_view.h" |
| 13 #include "views/widget/window_manager.h" | 15 #include "views/widget/window_manager.h" |
| 14 | 16 |
| 15 #if defined(HAVE_IBUS) | 17 #if defined(HAVE_IBUS) |
| 16 #include "views/ime/input_method_ibus.h" | 18 #include "views/ime/input_method_ibus.h" |
| 17 #else | 19 #else |
| 18 #include "views/ime/mock_input_method.h" | 20 #include "views/ime/mock_input_method.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 restored_bounds_ = view_->bounds(); | 438 restored_bounds_ = view_->bounds(); |
| 437 restored_transform_ = view_->GetTransform(); | 439 restored_transform_ = view_->GetTransform(); |
| 438 } | 440 } |
| 439 | 441 |
| 440 window_state_ = ui::SHOW_STATE_MAXIMIZED; | 442 window_state_ = ui::SHOW_STATE_MAXIMIZED; |
| 441 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); | 443 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); |
| 442 SetBounds(gfx::Rect(gfx::Point(), size)); | 444 SetBounds(gfx::Rect(gfx::Point(), size)); |
| 443 } | 445 } |
| 444 | 446 |
| 445 void NativeWidgetViews::Minimize() { | 447 void NativeWidgetViews::Minimize() { |
| 448 if (view_->layer() && view_->layer()->GetAnimator().IsAnimating()) |
| 449 return; |
| 450 |
| 446 gfx::Rect view_bounds = view_->bounds(); | 451 gfx::Rect view_bounds = view_->bounds(); |
| 447 gfx::Rect parent_bounds = view_->parent()->bounds(); | 452 gfx::Rect parent_bounds = view_->parent()->bounds(); |
| 448 | 453 |
| 449 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { | 454 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { |
| 450 restored_bounds_ = view_bounds; | 455 restored_bounds_ = view_bounds; |
| 451 restored_transform_ = view_->GetTransform(); | 456 restored_transform_ = view_->GetTransform(); |
| 452 } | 457 } |
| 453 | 458 |
| 454 float aspect_ratio = static_cast<float>(view_bounds.width()) / | 459 float aspect_ratio = static_cast<float>(view_bounds.width()) / |
| 455 static_cast<float>(view_bounds.height()); | 460 static_cast<float>(view_bounds.height()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 477 | 482 |
| 478 bool NativeWidgetViews::IsMaximized() const { | 483 bool NativeWidgetViews::IsMaximized() const { |
| 479 return window_state_ == ui::SHOW_STATE_MAXIMIZED; | 484 return window_state_ == ui::SHOW_STATE_MAXIMIZED; |
| 480 } | 485 } |
| 481 | 486 |
| 482 bool NativeWidgetViews::IsMinimized() const { | 487 bool NativeWidgetViews::IsMinimized() const { |
| 483 return window_state_ == ui::SHOW_STATE_MINIMIZED; | 488 return window_state_ == ui::SHOW_STATE_MINIMIZED; |
| 484 } | 489 } |
| 485 | 490 |
| 486 void NativeWidgetViews::Restore() { | 491 void NativeWidgetViews::Restore() { |
| 492 if (view_->layer() && view_->layer()->GetAnimator().IsAnimating()) |
| 493 return; |
| 494 |
| 487 window_state_ = ui::SHOW_STATE_NORMAL; | 495 window_state_ = ui::SHOW_STATE_NORMAL; |
| 488 view_->SetBoundsRect(restored_bounds_); | 496 view_->SetBoundsRect(restored_bounds_); |
| 489 view_->SetTransform(restored_transform_); | 497 view_->SetTransform(restored_transform_); |
| 490 } | 498 } |
| 491 | 499 |
| 492 void NativeWidgetViews::SetFullscreen(bool fullscreen) { | 500 void NativeWidgetViews::SetFullscreen(bool fullscreen) { |
| 493 NOTIMPLEMENTED(); | 501 NOTIMPLEMENTED(); |
| 494 } | 502 } |
| 495 | 503 |
| 496 bool NativeWidgetViews::IsFullscreen() const { | 504 bool NativeWidgetViews::IsFullscreen() const { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 616 } |
| 609 default: | 617 default: |
| 610 // Everything else falls into standard client event handling. | 618 // Everything else falls into standard client event handling. |
| 611 break; | 619 break; |
| 612 } | 620 } |
| 613 } | 621 } |
| 614 return false; | 622 return false; |
| 615 } | 623 } |
| 616 | 624 |
| 617 } // namespace views | 625 } // namespace views |
| OLD | NEW |