| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This has to be before any other includes, else default is picked up. | 5 // This has to be before any other includes, else default is picked up. |
| 6 // See base/logging for details on this. | 6 // See base/logging for details on this. |
| 7 #define NOTIMPLEMENTED_POLICY 5 | 7 #define NOTIMPLEMENTED_POLICY 5 |
| 8 | 8 |
| 9 #include "ui/views/mus/native_widget_mus.h" | 9 #include "ui/views/mus/native_widget_mus.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "services/ui/public/cpp/window_property.h" | 23 #include "services/ui/public/cpp/window_property.h" |
| 24 #include "services/ui/public/cpp/window_tree_client.h" | 24 #include "services/ui/public/cpp/window_tree_client.h" |
| 25 #include "services/ui/public/interfaces/cursor.mojom.h" | 25 #include "services/ui/public/interfaces/cursor.mojom.h" |
| 26 #include "services/ui/public/interfaces/window_manager.mojom.h" | 26 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 27 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 27 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 28 #include "services/ui/public/interfaces/window_tree.mojom.h" | 28 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 29 #include "ui/aura/client/default_capture_client.h" | 29 #include "ui/aura/client/default_capture_client.h" |
| 30 #include "ui/aura/client/window_parenting_client.h" | 30 #include "ui/aura/client/window_parenting_client.h" |
| 31 #include "ui/aura/layout_manager.h" | 31 #include "ui/aura/layout_manager.h" |
| 32 #include "ui/aura/mus/mus_util.h" | 32 #include "ui/aura/mus/mus_util.h" |
| 33 #include "ui/aura/mus/property_converter.h" |
| 33 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
| 34 #include "ui/aura/window_property.h" | 35 #include "ui/aura/window_property.h" |
| 35 #include "ui/base/hit_test.h" | 36 #include "ui/base/hit_test.h" |
| 36 #include "ui/display/display.h" | 37 #include "ui/display/display.h" |
| 37 #include "ui/display/screen.h" | 38 #include "ui/display/screen.h" |
| 38 #include "ui/events/event.h" | 39 #include "ui/events/event.h" |
| 39 #include "ui/gfx/canvas.h" | 40 #include "ui/gfx/canvas.h" |
| 40 #include "ui/gfx/path.h" | 41 #include "ui/gfx/path.h" |
| 41 #include "ui/native_theme/native_theme_aura.h" | 42 #include "ui/native_theme/native_theme_aura.h" |
| 42 #include "ui/platform_window/platform_window_delegate.h" | 43 #include "ui/platform_window/platform_window_delegate.h" |
| 43 #include "ui/views/corewm/tooltip.h" | 44 #include "ui/views/corewm/tooltip.h" |
| 44 #include "ui/views/corewm/tooltip_aura.h" | 45 #include "ui/views/corewm/tooltip_aura.h" |
| 45 #include "ui/views/corewm/tooltip_controller.h" | 46 #include "ui/views/corewm/tooltip_controller.h" |
| 46 #include "ui/views/drag_utils.h" | 47 #include "ui/views/drag_utils.h" |
| 47 #include "ui/views/mus/desktop_window_tree_host_mus.h" | |
| 48 #include "ui/views/mus/drag_drop_client_mus.h" | 48 #include "ui/views/mus/drag_drop_client_mus.h" |
| 49 #include "ui/views/mus/drop_target_mus.h" | 49 #include "ui/views/mus/drop_target_mus.h" |
| 50 #include "ui/views/mus/input_method_mus.h" | 50 #include "ui/views/mus/input_method_mus.h" |
| 51 #include "ui/views/mus/window_manager_connection.h" | 51 #include "ui/views/mus/window_manager_connection.h" |
| 52 #include "ui/views/mus/window_manager_constants_converters.h" | 52 #include "ui/views/mus/window_manager_constants_converters.h" |
| 53 #include "ui/views/mus/window_manager_frame_values.h" | 53 #include "ui/views/mus/window_manager_frame_values.h" |
| 54 #include "ui/views/mus/window_tree_host_mus.h" | 54 #include "ui/views/mus/window_tree_host_mus.h" |
| 55 #include "ui/views/widget/drop_helper.h" | 55 #include "ui/views/widget/drop_helper.h" |
| 56 #include "ui/views/widget/native_widget_aura.h" | 56 #include "ui/views/widget/native_widget_aura.h" |
| 57 #include "ui/views/widget/tooltip_manager_aura.h" | 57 #include "ui/views/widget/tooltip_manager_aura.h" |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 init_params.mus_properties.end()); | 658 init_params.mus_properties.end()); |
| 659 if (!init_params.bounds.IsEmpty()) { | 659 if (!init_params.bounds.IsEmpty()) { |
| 660 (*properties)[ui::mojom::WindowManager::kUserSetBounds_Property] = | 660 (*properties)[ui::mojom::WindowManager::kUserSetBounds_Property] = |
| 661 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds); | 661 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds); |
| 662 } | 662 } |
| 663 if (!init_params.name.empty()) { | 663 if (!init_params.name.empty()) { |
| 664 (*properties)[ui::mojom::WindowManager::kName_Property] = | 664 (*properties)[ui::mojom::WindowManager::kName_Property] = |
| 665 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name); | 665 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name); |
| 666 } | 666 } |
| 667 (*properties)[ui::mojom::WindowManager::kAlwaysOnTop_Property] = | 667 (*properties)[ui::mojom::WindowManager::kAlwaysOnTop_Property] = |
| 668 mojo::ConvertTo<std::vector<uint8_t>>(init_params.keep_on_top); | 668 mojo::ConvertTo<std::vector<uint8_t>>( |
| 669 static_cast<aura::PropertyConverter::PrimitiveType>( |
| 670 init_params.keep_on_top)); |
| 669 | 671 |
| 670 if (!Widget::RequiresNonClientView(init_params.type)) | 672 if (!Widget::RequiresNonClientView(init_params.type)) |
| 671 return; | 673 return; |
| 672 | 674 |
| 673 (*properties)[ui::mojom::WindowManager::kWindowType_Property] = | 675 (*properties)[ui::mojom::WindowManager::kWindowType_Property] = |
| 674 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>( | 676 mojo::ConvertTo<std::vector<uint8_t>>( |
| 675 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type))); | 677 static_cast<aura::PropertyConverter::PrimitiveType>( |
| 676 if (init_params.delegate && | 678 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type))); |
| 677 properties->count(ui::mojom::WindowManager::kResizeBehavior_Property) == | |
| 678 0) { | |
| 679 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] = | |
| 680 mojo::ConvertTo<std::vector<uint8_t>>( | |
| 681 DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate( | |
| 682 init_params.delegate)); | |
| 683 } | |
| 684 | 679 |
| 685 if (init_params.delegate) { | 680 if (init_params.delegate) { |
| 681 if (properties->count(ui::mojom::WindowManager::kResizeBehavior_Property) == |
| 682 0) { |
| 683 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] = |
| 684 mojo::ConvertTo<std::vector<uint8_t>>( |
| 685 static_cast<aura::PropertyConverter::PrimitiveType>( |
| 686 init_params.delegate->GetResizeBehavior())); |
| 687 } |
| 688 |
| 686 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. | 689 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. |
| 687 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon(); | 690 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon(); |
| 688 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap(); | 691 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap(); |
| 689 if (!app_bitmap.isNull()) { | 692 if (!app_bitmap.isNull()) { |
| 690 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] = | 693 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] = |
| 691 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap); | 694 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap); |
| 692 } | 695 } |
| 693 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. | 696 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. |
| 694 gfx::ImageSkia window_icon = init_params.delegate->GetWindowIcon(); | 697 gfx::ImageSkia window_icon = init_params.delegate->GetWindowIcon(); |
| 695 SkBitmap window_bitmap = window_icon.GetRepresentation(1.f).sk_bitmap(); | 698 SkBitmap window_bitmap = window_icon.GetRepresentation(1.f).sk_bitmap(); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 | 1321 |
| 1319 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const { | 1322 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const { |
| 1320 NOTIMPLEMENTED(); | 1323 NOTIMPLEMENTED(); |
| 1321 return true; | 1324 return true; |
| 1322 } | 1325 } |
| 1323 | 1326 |
| 1324 void NativeWidgetMus::OnSizeConstraintsChanged() { | 1327 void NativeWidgetMus::OnSizeConstraintsChanged() { |
| 1325 if (!window_ || is_parallel_widget_in_window_manager()) | 1328 if (!window_ || is_parallel_widget_in_window_manager()) |
| 1326 return; | 1329 return; |
| 1327 | 1330 |
| 1331 int32_t behavior = ui::mojom::kResizeBehaviorNone; |
| 1332 if (GetWidget()->widget_delegate()) |
| 1333 behavior = GetWidget()->widget_delegate()->GetResizeBehavior(); |
| 1328 window_->SetSharedProperty<int32_t>( | 1334 window_->SetSharedProperty<int32_t>( |
| 1329 ui::mojom::WindowManager::kResizeBehavior_Property, | 1335 ui::mojom::WindowManager::kResizeBehavior_Property, behavior); |
| 1330 DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate( | |
| 1331 GetWidget()->widget_delegate())); | |
| 1332 } | 1336 } |
| 1333 | 1337 |
| 1334 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { | 1338 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { |
| 1335 NOTIMPLEMENTED(); | 1339 NOTIMPLEMENTED(); |
| 1336 } | 1340 } |
| 1337 | 1341 |
| 1338 std::string NativeWidgetMus::GetName() const { | 1342 std::string NativeWidgetMus::GetName() const { |
| 1339 return window_->GetName(); | 1343 return window_->GetName(); |
| 1340 } | 1344 } |
| 1341 | 1345 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 | 1568 |
| 1565 gfx::Path mask_path; | 1569 gfx::Path mask_path; |
| 1566 native_widget_delegate_->GetHitTestMask(&mask_path); | 1570 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1567 // TODO(jamescook): Use the full path for the mask. | 1571 // TODO(jamescook): Use the full path for the mask. |
| 1568 gfx::Rect mask_rect = | 1572 gfx::Rect mask_rect = |
| 1569 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1573 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1570 window_->SetHitTestMask(mask_rect); | 1574 window_->SetHitTestMask(mask_rect); |
| 1571 } | 1575 } |
| 1572 | 1576 |
| 1573 } // namespace views | 1577 } // namespace views |
| OLD | NEW |