| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "services/ui/public/interfaces/window_manager.mojom.h" | 14 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 15 #include "third_party/skia/include/core/SkRegion.h" | 16 #include "third_party/skia/include/core/SkRegion.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/client/capture_client.h" | 18 #include "ui/aura/client/capture_client.h" |
| 18 #include "ui/aura/client/cursor_client.h" | 19 #include "ui/aura/client/cursor_client.h" |
| 19 #include "ui/aura/client/drag_drop_client.h" | 20 #include "ui/aura/client/drag_drop_client.h" |
| 20 #include "ui/aura/client/focus_client.h" | 21 #include "ui/aura/client/focus_client.h" |
| 21 #include "ui/aura/client/screen_position_client.h" | 22 #include "ui/aura/client/screen_position_client.h" |
| 22 #include "ui/aura/client/window_parenting_client.h" | 23 #include "ui/aura/client/window_parenting_client.h" |
| 23 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
| 24 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 762 } |
| 762 | 763 |
| 763 bool NativeWidgetAura::IsTranslucentWindowOpacitySupported() const { | 764 bool NativeWidgetAura::IsTranslucentWindowOpacitySupported() const { |
| 764 return true; | 765 return true; |
| 765 } | 766 } |
| 766 | 767 |
| 767 void NativeWidgetAura::OnSizeConstraintsChanged() { | 768 void NativeWidgetAura::OnSizeConstraintsChanged() { |
| 768 if (is_parallel_widget_in_window_manager_) | 769 if (is_parallel_widget_in_window_manager_) |
| 769 return; | 770 return; |
| 770 | 771 |
| 771 window_->SetProperty(aura::client::kCanMaximizeKey, | 772 int32_t behavior = ui::mojom::kResizeBehaviorNone; |
| 772 GetWidget()->widget_delegate()->CanMaximize()); | 773 if (GetWidget()->widget_delegate()) |
| 773 window_->SetProperty(aura::client::kCanMinimizeKey, | 774 behavior = GetWidget()->widget_delegate()->GetResizeBehavior(); |
| 774 GetWidget()->widget_delegate()->CanMinimize()); | 775 window_->SetProperty(aura::client::kResizeBehaviorKey, behavior); |
| 775 window_->SetProperty(aura::client::kCanResizeKey, | |
| 776 GetWidget()->widget_delegate()->CanResize()); | |
| 777 } | 776 } |
| 778 | 777 |
| 779 void NativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) { | 778 void NativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) { |
| 780 OnEvent(native_event); | 779 OnEvent(native_event); |
| 781 } | 780 } |
| 782 | 781 |
| 783 std::string NativeWidgetAura::GetName() const { | 782 std::string NativeWidgetAura::GetName() const { |
| 784 return window_ ? window_->GetName() : std::string(); | 783 return window_ ? window_->GetName() : std::string(); |
| 785 } | 784 } |
| 786 | 785 |
| 787 //////////////////////////////////////////////////////////////////////////////// | 786 //////////////////////////////////////////////////////////////////////////////// |
| 788 // NativeWidgetAura, aura::WindowDelegate implementation: | 787 // NativeWidgetAura, aura::WindowDelegate implementation: |
| 789 | 788 |
| 790 gfx::Size NativeWidgetAura::GetMinimumSize() const { | 789 gfx::Size NativeWidgetAura::GetMinimumSize() const { |
| 791 return delegate_->GetMinimumSize(); | 790 return delegate_->GetMinimumSize(); |
| 792 } | 791 } |
| 793 | 792 |
| 794 gfx::Size NativeWidgetAura::GetMaximumSize() const { | 793 gfx::Size NativeWidgetAura::GetMaximumSize() const { |
| 795 // If a window have a maximum size, the window should not be | 794 // A window should not have a maximum size and also be maximizable. |
| 796 // maximizable. | |
| 797 DCHECK(delegate_->GetMaximumSize().IsEmpty() || | 795 DCHECK(delegate_->GetMaximumSize().IsEmpty() || |
| 798 !window_->GetProperty(aura::client::kCanMaximizeKey)); | 796 !(window_->GetProperty(aura::client::kResizeBehaviorKey) & |
| 797 ui::mojom::kResizeBehaviorCanMaximize)); |
| 799 return delegate_->GetMaximumSize(); | 798 return delegate_->GetMaximumSize(); |
| 800 } | 799 } |
| 801 | 800 |
| 802 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 801 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 803 const gfx::Rect& new_bounds) { | 802 const gfx::Rect& new_bounds) { |
| 804 // Assume that if the old bounds was completely empty a move happened. This | 803 // Assume that if the old bounds was completely empty a move happened. This |
| 805 // handles the case of a maximize animation acquiring the layer (acquiring a | 804 // handles the case of a maximize animation acquiring the layer (acquiring a |
| 806 // layer results in clearing the bounds). | 805 // layer results in clearing the bounds). |
| 807 if (old_bounds.origin() != new_bounds.origin() || | 806 if (old_bounds.origin() != new_bounds.origin() || |
| 808 (old_bounds == gfx::Rect(0, 0, 0, 0) && !new_bounds.IsEmpty())) { | 807 (old_bounds == gfx::Rect(0, 0, 0, 0) && !new_bounds.IsEmpty())) { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 gfx::NativeView native_view) { | 1222 gfx::NativeView native_view) { |
| 1224 aura::client::CaptureClient* capture_client = | 1223 aura::client::CaptureClient* capture_client = |
| 1225 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1224 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1226 if (!capture_client) | 1225 if (!capture_client) |
| 1227 return nullptr; | 1226 return nullptr; |
| 1228 return capture_client->GetGlobalCaptureWindow(); | 1227 return capture_client->GetGlobalCaptureWindow(); |
| 1229 } | 1228 } |
| 1230 | 1229 |
| 1231 } // namespace internal | 1230 } // namespace internal |
| 1232 } // namespace views | 1231 } // namespace views |
| OLD | NEW |