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 #include "ui/views/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "services/ui/common/gpu_service.h" | 12 #include "services/ui/common/gpu_service.h" |
13 #include "services/ui/public/cpp/property_type_converters.h" | 13 #include "services/ui/public/cpp/property_type_converters.h" |
14 #include "services/ui/public/cpp/window.h" | 14 #include "services/ui/public/cpp/window.h" |
15 #include "services/ui/public/cpp/window_observer.h" | 15 #include "services/ui/public/cpp/window_observer.h" |
16 #include "services/ui/public/cpp/window_property.h" | 16 #include "services/ui/public/cpp/window_property.h" |
17 #include "services/ui/public/cpp/window_tree_client.h" | 17 #include "services/ui/public/cpp/window_tree_client.h" |
18 #include "services/ui/public/interfaces/cursor.mojom.h" | 18 #include "services/ui/public/interfaces/cursor.mojom.h" |
19 #include "services/ui/public/interfaces/window_manager.mojom.h" | 19 #include "services/ui/public/interfaces/window_manager.mojom.h" |
20 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 20 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
21 #include "services/ui/public/interfaces/window_tree.mojom.h" | 21 #include "services/ui/public/interfaces/window_tree.mojom.h" |
22 #include "ui/aura/client/default_capture_client.h" | 22 #include "ui/aura/client/default_capture_client.h" |
23 #include "ui/aura/client/window_tree_client.h" | 23 #include "ui/aura/client/window_tree_client.h" |
24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
25 #include "ui/aura/layout_manager.h" | 25 #include "ui/aura/layout_manager.h" |
26 #include "ui/aura/mus/mus_util.h" | 26 #include "ui/aura/mus/mus_util.h" |
27 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
28 #include "ui/aura/window_property.h" | 28 #include "ui/aura/window_property.h" |
29 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
| 30 #include "ui/base/view_prop.h" |
30 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
31 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
32 #include "ui/events/event.h" | 33 #include "ui/events/event.h" |
33 #include "ui/gfx/canvas.h" | 34 #include "ui/gfx/canvas.h" |
34 #include "ui/gfx/path.h" | 35 #include "ui/gfx/path.h" |
35 #include "ui/native_theme/native_theme_aura.h" | 36 #include "ui/native_theme/native_theme_aura.h" |
36 #include "ui/platform_window/platform_window_delegate.h" | 37 #include "ui/platform_window/platform_window_delegate.h" |
37 #include "ui/views/mus/surface_context_factory.h" | 38 #include "ui/views/mus/surface_context_factory.h" |
38 #include "ui/views/mus/window_manager_constants_converters.h" | 39 #include "ui/views/mus/window_manager_constants_converters.h" |
39 #include "ui/views/mus/window_manager_frame_values.h" | 40 #include "ui/views/mus/window_manager_frame_values.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // aura::Env. Install |context_factory_| there so that |context_factory_| is | 526 // aura::Env. Install |context_factory_| there so that |context_factory_| is |
526 // picked up. | 527 // picked up. |
527 ui::ContextFactory* default_context_factory = | 528 ui::ContextFactory* default_context_factory = |
528 aura::Env::GetInstance()->context_factory(); | 529 aura::Env::GetInstance()->context_factory(); |
529 if (!default_context_factory) { | 530 if (!default_context_factory) { |
530 context_factory_.reset(new SurfaceContextFactory(window_, surface_type_)); | 531 context_factory_.reset(new SurfaceContextFactory(window_, surface_type_)); |
531 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); | 532 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); |
532 } | 533 } |
533 | 534 |
534 window_tree_host_.reset(new WindowTreeHostMus(this, window_)); | 535 window_tree_host_.reset(new WindowTreeHostMus(this, window_)); |
| 536 prop_.reset(new ui::ViewProp(window_tree_host_->GetAcceleratedWidget(), |
| 537 ui::kWindowForAcceleratedWidget, |
| 538 window_)); |
535 aura::Env::GetInstance()->set_context_factory(default_context_factory); | 539 aura::Env::GetInstance()->set_context_factory(default_context_factory); |
536 } | 540 } |
537 | 541 |
538 NativeWidgetMus::~NativeWidgetMus() { | 542 NativeWidgetMus::~NativeWidgetMus() { |
539 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { | 543 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { |
540 DCHECK(!window_); | 544 DCHECK(!window_); |
541 delete native_widget_delegate_; | 545 delete native_widget_delegate_; |
542 } else { | 546 } else { |
543 if (window_) | 547 if (window_) |
544 window_->set_input_event_handler(nullptr); | 548 window_->set_input_event_handler(nullptr); |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 | 1421 |
1418 gfx::Path mask_path; | 1422 gfx::Path mask_path; |
1419 native_widget_delegate_->GetHitTestMask(&mask_path); | 1423 native_widget_delegate_->GetHitTestMask(&mask_path); |
1420 // TODO(jamescook): Use the full path for the mask. | 1424 // TODO(jamescook): Use the full path for the mask. |
1421 gfx::Rect mask_rect = | 1425 gfx::Rect mask_rect = |
1422 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1426 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1423 window_->SetHitTestMask(mask_rect); | 1427 window_->SetHitTestMask(mask_rect); |
1424 } | 1428 } |
1425 | 1429 |
1426 } // namespace views | 1430 } // namespace views |
OLD | NEW |