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

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

Issue 2538633002: Adds a couple more properties to the property converter (Closed)
Patch Set: merge again 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
« no previous file with comments | « ui/views/mus/mus_client.cc ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
47 #include "ui/views/mus/drag_drop_client_mus.h" 48 #include "ui/views/mus/drag_drop_client_mus.h"
48 #include "ui/views/mus/drop_target_mus.h" 49 #include "ui/views/mus/drop_target_mus.h"
49 #include "ui/views/mus/input_method_mus.h" 50 #include "ui/views/mus/input_method_mus.h"
50 #include "ui/views/mus/window_manager_connection.h" 51 #include "ui/views/mus/window_manager_connection.h"
51 #include "ui/views/mus/window_manager_constants_converters.h" 52 #include "ui/views/mus/window_manager_constants_converters.h"
52 #include "ui/views/mus/window_manager_frame_values.h" 53 #include "ui/views/mus/window_manager_frame_values.h"
53 #include "ui/views/mus/window_tree_host_mus.h" 54 #include "ui/views/mus/window_tree_host_mus.h"
54 #include "ui/views/widget/drop_helper.h" 55 #include "ui/views/widget/drop_helper.h"
55 #include "ui/views/widget/native_widget_aura.h" 56 #include "ui/views/widget/native_widget_aura.h"
56 #include "ui/views/widget/tooltip_manager_aura.h" 57 #include "ui/views/widget/tooltip_manager_aura.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 .size(); 317 .size();
317 return gfx::Size(max_size.width() == 0 ? 0 : converted_size.width(), 318 return gfx::Size(max_size.width() == 0 ? 0 : converted_size.width(),
318 max_size.height() == 0 ? 0 : converted_size.height()); 319 max_size.height() == 0 ? 0 : converted_size.height());
319 } 320 }
320 321
321 views::Widget* widget_; 322 views::Widget* widget_;
322 323
323 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); 324 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView);
324 }; 325 };
325 326
326 int ResizeBehaviorFromDelegate(WidgetDelegate* delegate) {
327 if (!delegate)
328 return ui::mojom::kResizeBehaviorNone;
329
330 int32_t behavior = ui::mojom::kResizeBehaviorNone;
331 if (delegate->CanResize())
332 behavior |= ui::mojom::kResizeBehaviorCanResize;
333 if (delegate->CanMaximize())
334 behavior |= ui::mojom::kResizeBehaviorCanMaximize;
335 if (delegate->CanMinimize())
336 behavior |= ui::mojom::kResizeBehaviorCanMinimize;
337 return behavior;
338 }
339
340 // Handles acknowledgment of an input event, either immediately when a nested 327 // Handles acknowledgment of an input event, either immediately when a nested
341 // message loop starts, or upon destruction. 328 // message loop starts, or upon destruction.
342 class EventAckHandler : public base::MessageLoop::NestingObserver { 329 class EventAckHandler : public base::MessageLoop::NestingObserver {
343 public: 330 public:
344 explicit EventAckHandler( 331 explicit EventAckHandler(
345 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback) 332 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback)
346 : ack_callback_(std::move(ack_callback)) { 333 : ack_callback_(std::move(ack_callback)) {
347 DCHECK(ack_callback_); 334 DCHECK(ack_callback_);
348 base::MessageLoop::current()->AddNestingObserver(this); 335 base::MessageLoop::current()->AddNestingObserver(this);
349 } 336 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 return; 671 return;
685 672
686 (*properties)[ui::mojom::WindowManager::kWindowType_Property] = 673 (*properties)[ui::mojom::WindowManager::kWindowType_Property] =
687 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>( 674 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>(
688 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type))); 675 mojo::ConvertTo<ui::mojom::WindowType>(init_params.type)));
689 if (init_params.delegate && 676 if (init_params.delegate &&
690 properties->count(ui::mojom::WindowManager::kResizeBehavior_Property) == 677 properties->count(ui::mojom::WindowManager::kResizeBehavior_Property) ==
691 0) { 678 0) {
692 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] = 679 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] =
693 mojo::ConvertTo<std::vector<uint8_t>>( 680 mojo::ConvertTo<std::vector<uint8_t>>(
694 ResizeBehaviorFromDelegate(init_params.delegate)); 681 DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate(
682 init_params.delegate));
695 } 683 }
696 684
697 if (init_params.delegate) { 685 if (init_params.delegate) {
698 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia]. 686 // TODO(crbug.com/667566): Support additional scales or gfx::Image[Skia].
699 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon(); 687 gfx::ImageSkia app_icon = init_params.delegate->GetWindowAppIcon();
700 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap(); 688 SkBitmap app_bitmap = app_icon.GetRepresentation(1.f).sk_bitmap();
701 if (!app_bitmap.isNull()) { 689 if (!app_bitmap.isNull()) {
702 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] = 690 (*properties)[ui::mojom::WindowManager::kAppIcon_Property] =
703 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap); 691 mojo::ConvertTo<std::vector<uint8_t>>(app_bitmap);
704 } 692 }
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 NOTIMPLEMENTED(); 1320 NOTIMPLEMENTED();
1333 return true; 1321 return true;
1334 } 1322 }
1335 1323
1336 void NativeWidgetMus::OnSizeConstraintsChanged() { 1324 void NativeWidgetMus::OnSizeConstraintsChanged() {
1337 if (!window_ || is_parallel_widget_in_window_manager()) 1325 if (!window_ || is_parallel_widget_in_window_manager())
1338 return; 1326 return;
1339 1327
1340 window_->SetSharedProperty<int32_t>( 1328 window_->SetSharedProperty<int32_t>(
1341 ui::mojom::WindowManager::kResizeBehavior_Property, 1329 ui::mojom::WindowManager::kResizeBehavior_Property,
1342 ResizeBehaviorFromDelegate(GetWidget()->widget_delegate())); 1330 DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate(
1331 GetWidget()->widget_delegate()));
1343 } 1332 }
1344 1333
1345 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { 1334 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) {
1346 NOTIMPLEMENTED(); 1335 NOTIMPLEMENTED();
1347 } 1336 }
1348 1337
1349 std::string NativeWidgetMus::GetName() const { 1338 std::string NativeWidgetMus::GetName() const {
1350 return window_->GetName(); 1339 return window_->GetName();
1351 } 1340 }
1352 1341
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1564
1576 gfx::Path mask_path; 1565 gfx::Path mask_path;
1577 native_widget_delegate_->GetHitTestMask(&mask_path); 1566 native_widget_delegate_->GetHitTestMask(&mask_path);
1578 // TODO(jamescook): Use the full path for the mask. 1567 // TODO(jamescook): Use the full path for the mask.
1579 gfx::Rect mask_rect = 1568 gfx::Rect mask_rect =
1580 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1569 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1581 window_->SetHitTestMask(mask_rect); 1570 window_->SetHitTestMask(mask_rect);
1582 } 1571 }
1583 1572
1584 } // namespace views 1573 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/mus_client.cc ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698