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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 restored_bounds_ = view_->bounds(); | 457 restored_bounds_ = view_->bounds(); |
456 restored_transform_ = view_->GetTransform(); | 458 restored_transform_ = view_->GetTransform(); |
457 } | 459 } |
458 | 460 |
459 window_state_ = ui::SHOW_STATE_MAXIMIZED; | 461 window_state_ = ui::SHOW_STATE_MAXIMIZED; |
460 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); | 462 gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size(); |
461 SetBounds(gfx::Rect(gfx::Point(), size)); | 463 SetBounds(gfx::Rect(gfx::Point(), size)); |
462 } | 464 } |
463 | 465 |
464 void NativeWidgetViews::Minimize() { | 466 void NativeWidgetViews::Minimize() { |
| 467 if (view_->layer() && view_->layer()->GetAnimator()->is_animating()) |
| 468 return; |
| 469 |
465 gfx::Rect view_bounds = view_->bounds(); | 470 gfx::Rect view_bounds = view_->bounds(); |
466 gfx::Rect parent_bounds = view_->parent()->bounds(); | 471 gfx::Rect parent_bounds = view_->parent()->bounds(); |
467 | 472 |
468 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { | 473 if (window_state_ != ui::SHOW_STATE_MAXIMIZED) { |
469 restored_bounds_ = view_bounds; | 474 restored_bounds_ = view_bounds; |
470 restored_transform_ = view_->GetTransform(); | 475 restored_transform_ = view_->GetTransform(); |
471 } | 476 } |
472 | 477 |
473 float aspect_ratio = static_cast<float>(view_bounds.width()) / | 478 float aspect_ratio = static_cast<float>(view_bounds.width()) / |
474 static_cast<float>(view_bounds.height()); | 479 static_cast<float>(view_bounds.height()); |
(...skipping 21 matching lines...) Expand all Loading... |
496 | 501 |
497 bool NativeWidgetViews::IsMaximized() const { | 502 bool NativeWidgetViews::IsMaximized() const { |
498 return window_state_ == ui::SHOW_STATE_MAXIMIZED; | 503 return window_state_ == ui::SHOW_STATE_MAXIMIZED; |
499 } | 504 } |
500 | 505 |
501 bool NativeWidgetViews::IsMinimized() const { | 506 bool NativeWidgetViews::IsMinimized() const { |
502 return window_state_ == ui::SHOW_STATE_MINIMIZED; | 507 return window_state_ == ui::SHOW_STATE_MINIMIZED; |
503 } | 508 } |
504 | 509 |
505 void NativeWidgetViews::Restore() { | 510 void NativeWidgetViews::Restore() { |
| 511 if (view_->layer() && view_->layer()->GetAnimator()->is_animating()) |
| 512 return; |
| 513 |
506 window_state_ = ui::SHOW_STATE_NORMAL; | 514 window_state_ = ui::SHOW_STATE_NORMAL; |
507 view_->SetBoundsRect(restored_bounds_); | 515 view_->SetBoundsRect(restored_bounds_); |
508 view_->SetTransform(restored_transform_); | 516 view_->SetTransform(restored_transform_); |
509 } | 517 } |
510 | 518 |
511 void NativeWidgetViews::SetFullscreen(bool fullscreen) { | 519 void NativeWidgetViews::SetFullscreen(bool fullscreen) { |
512 NOTIMPLEMENTED(); | 520 NOTIMPLEMENTED(); |
513 } | 521 } |
514 | 522 |
515 bool NativeWidgetViews::IsFullscreen() const { | 523 bool NativeWidgetViews::IsFullscreen() const { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 } | 635 } |
628 default: | 636 default: |
629 // Everything else falls into standard client event handling. | 637 // Everything else falls into standard client event handling. |
630 break; | 638 break; |
631 } | 639 } |
632 } | 640 } |
633 return false; | 641 return false; |
634 } | 642 } |
635 | 643 |
636 } // namespace views | 644 } // namespace views |
OLD | NEW |