Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2542493002: Replace kCanMaximize/Minimize/Resize with kResizeBehavior. (Closed)
Patch Set: Cleanup, fixes, and refinements. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 #include "ui/display/screen.h" 37 #include "ui/display/screen.h"
38 #include "ui/events/event.h" 38 #include "ui/events/event.h"
39 #include "ui/gfx/canvas.h" 39 #include "ui/gfx/canvas.h"
40 #include "ui/gfx/path.h" 40 #include "ui/gfx/path.h"
41 #include "ui/native_theme/native_theme_aura.h" 41 #include "ui/native_theme/native_theme_aura.h"
42 #include "ui/platform_window/platform_window_delegate.h" 42 #include "ui/platform_window/platform_window_delegate.h"
43 #include "ui/views/corewm/tooltip.h" 43 #include "ui/views/corewm/tooltip.h"
44 #include "ui/views/corewm/tooltip_aura.h" 44 #include "ui/views/corewm/tooltip_aura.h"
45 #include "ui/views/corewm/tooltip_controller.h" 45 #include "ui/views/corewm/tooltip_controller.h"
46 #include "ui/views/drag_utils.h" 46 #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" 47 #include "ui/views/mus/drag_drop_client_mus.h"
49 #include "ui/views/mus/drop_target_mus.h" 48 #include "ui/views/mus/drop_target_mus.h"
50 #include "ui/views/mus/input_method_mus.h" 49 #include "ui/views/mus/input_method_mus.h"
51 #include "ui/views/mus/window_manager_connection.h" 50 #include "ui/views/mus/window_manager_connection.h"
52 #include "ui/views/mus/window_manager_constants_converters.h" 51 #include "ui/views/mus/window_manager_constants_converters.h"
53 #include "ui/views/mus/window_manager_frame_values.h" 52 #include "ui/views/mus/window_manager_frame_values.h"
54 #include "ui/views/mus/window_tree_host_mus.h" 53 #include "ui/views/mus/window_tree_host_mus.h"
55 #include "ui/views/widget/drop_helper.h" 54 #include "ui/views/widget/drop_helper.h"
56 #include "ui/views/widget/native_widget_aura.h" 55 #include "ui/views/widget/native_widget_aura.h"
57 #include "ui/views/widget/tooltip_manager_aura.h" 56 #include "ui/views/widget/tooltip_manager_aura.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 init_params.mus_properties.end()); 657 init_params.mus_properties.end());
659 if (!init_params.bounds.IsEmpty()) { 658 if (!init_params.bounds.IsEmpty()) {
660 (*properties)[ui::mojom::WindowManager::kUserSetBounds_Property] = 659 (*properties)[ui::mojom::WindowManager::kUserSetBounds_Property] =
661 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds); 660 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds);
662 } 661 }
663 if (!init_params.name.empty()) { 662 if (!init_params.name.empty()) {
664 (*properties)[ui::mojom::WindowManager::kName_Property] = 663 (*properties)[ui::mojom::WindowManager::kName_Property] =
665 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name); 664 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name);
666 } 665 }
667 (*properties)[ui::mojom::WindowManager::kAlwaysOnTop_Property] = 666 (*properties)[ui::mojom::WindowManager::kAlwaysOnTop_Property] =
668 mojo::ConvertTo<std::vector<uint8_t>>(init_params.keep_on_top); 667 mojo::ConvertTo<std::vector<uint8_t>>(
668 static_cast<int64_t>(init_params.keep_on_top));
669 669
670 if (!Widget::RequiresNonClientView(init_params.type)) 670 if (!Widget::RequiresNonClientView(init_params.type))
671 return; 671 return;
672 672
673 (*properties)[ui::mojom::WindowManager::kWindowType_Property] = 673 (*properties)[ui::mojom::WindowManager::kWindowType_Property] =
674 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>( 674 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int64_t>(
sky 2016/11/30 03:17:28 optional as this code is going away at some point:
msw 2016/11/30 18:16:37 Done.
675 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type))); 675 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type)));
676 if (init_params.delegate &&
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 676
685 if (init_params.delegate) { 677 if (init_params.delegate) {
678 if (properties->count(ui::mojom::WindowManager::kResizeBehavior_Property) ==
679 0) {
680 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] =
681 mojo::ConvertTo<std::vector<uint8_t>>(
682 static_cast<int64_t>(init_params.delegate->GetResizeBehavior()));
683 }
684
686 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. 685 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia].
687 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon(); 686 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon();
688 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap(); 687 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap();
689 if (!app_bitmap.isNull()) { 688 if (!app_bitmap.isNull()) {
690 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] = 689 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] =
691 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap); 690 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap);
692 } 691 }
693 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. 692 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia].
694 gfx::ImageSkia window_icon = init_params.delegate->GetWindowIcon(); 693 gfx::ImageSkia window_icon = init_params.delegate->GetWindowIcon();
695 SkBitmap window_bitmap = window_icon.GetRepresentation(1.f).sk_bitmap(); 694 SkBitmap window_bitmap = window_icon.GetRepresentation(1.f).sk_bitmap();
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1317
1319 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const { 1318 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const {
1320 NOTIMPLEMENTED(); 1319 NOTIMPLEMENTED();
1321 return true; 1320 return true;
1322 } 1321 }
1323 1322
1324 void NativeWidgetMus::OnSizeConstraintsChanged() { 1323 void NativeWidgetMus::OnSizeConstraintsChanged() {
1325 if (!window_ || is_parallel_widget_in_window_manager()) 1324 if (!window_ || is_parallel_widget_in_window_manager())
1326 return; 1325 return;
1327 1326
1327 int32_t behavior = ui::mojom::kResizeBehaviorNone;
1328 if (GetWidget()->widget_delegate())
1329 behavior = GetWidget()->widget_delegate()->GetResizeBehavior();
1328 window_->SetSharedProperty<int32_t>( 1330 window_->SetSharedProperty<int32_t>(
1329 ui::mojom::WindowManager::kResizeBehavior_Property, 1331 ui::mojom::WindowManager::kResizeBehavior_Property, behavior);
1330 DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate(
1331 GetWidget()->widget_delegate()));
1332 } 1332 }
1333 1333
1334 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { 1334 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) {
1335 NOTIMPLEMENTED(); 1335 NOTIMPLEMENTED();
1336 } 1336 }
1337 1337
1338 std::string NativeWidgetMus::GetName() const { 1338 std::string NativeWidgetMus::GetName() const {
1339 return window_->GetName(); 1339 return window_->GetName();
1340 } 1340 }
1341 1341
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 1564
1565 gfx::Path mask_path; 1565 gfx::Path mask_path;
1566 native_widget_delegate_->GetHitTestMask(&mask_path); 1566 native_widget_delegate_->GetHitTestMask(&mask_path);
1567 // TODO(jamescook): Use the full path for the mask. 1567 // TODO(jamescook): Use the full path for the mask.
1568 gfx::Rect mask_rect = 1568 gfx::Rect mask_rect =
1569 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1569 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1570 window_->SetHitTestMask(mask_rect); 1570 window_->SetHitTestMask(mask_rect);
1571 } 1571 }
1572 1572
1573 } // namespace views 1573 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698