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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
26 #include "ui/aura/window_property.h" | 26 #include "ui/aura/window_property.h" |
27 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
28 #include "ui/display/display.h" | 28 #include "ui/display/display.h" |
29 #include "ui/display/screen.h" | 29 #include "ui/display/screen.h" |
30 #include "ui/events/event.h" | 30 #include "ui/events/event.h" |
31 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
32 #include "ui/gfx/path.h" | 32 #include "ui/gfx/path.h" |
33 #include "ui/native_theme/native_theme_aura.h" | 33 #include "ui/native_theme/native_theme_aura.h" |
34 #include "ui/platform_window/platform_window_delegate.h" | 34 #include "ui/platform_window/platform_window_delegate.h" |
| 35 #include "ui/views/mus/window_manager_connection.h" |
35 #include "ui/views/mus/window_manager_constants_converters.h" | 36 #include "ui/views/mus/window_manager_constants_converters.h" |
36 #include "ui/views/mus/window_manager_frame_values.h" | 37 #include "ui/views/mus/window_manager_frame_values.h" |
37 #include "ui/views/mus/window_tree_host_mus.h" | 38 #include "ui/views/mus/window_tree_host_mus.h" |
38 #include "ui/views/widget/native_widget_aura.h" | 39 #include "ui/views/widget/native_widget_aura.h" |
39 #include "ui/views/widget/widget_delegate.h" | 40 #include "ui/views/widget/widget_delegate.h" |
40 #include "ui/views/window/custom_frame_view.h" | 41 #include "ui/views/window/custom_frame_view.h" |
41 #include "ui/wm/core/base_focus_rules.h" | 42 #include "ui/wm/core/base_focus_rules.h" |
42 #include "ui/wm/core/capture_controller.h" | 43 #include "ui/wm/core/capture_controller.h" |
43 #include "ui/wm/core/cursor_manager.h" | 44 #include "ui/wm/core/cursor_manager.h" |
44 #include "ui/wm/core/default_screen_position_client.h" | 45 #include "ui/wm/core/default_screen_position_client.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 681 |
681 ownership_ = params.ownership; | 682 ownership_ = params.ownership; |
682 window_->SetCanFocus(params.activatable == | 683 window_->SetCanFocus(params.activatable == |
683 Widget::InitParams::ACTIVATABLE_YES); | 684 Widget::InitParams::ACTIVATABLE_YES); |
684 window_->SetCanAcceptEvents(params.accept_events); | 685 window_->SetCanAcceptEvents(params.accept_events); |
685 | 686 |
686 window_tree_host_->AddObserver(this); | 687 window_tree_host_->AddObserver(this); |
687 window_tree_host_->InitHost(); | 688 window_tree_host_->InitHost(); |
688 hosted_window->SetProperty(kMusWindow, window_); | 689 hosted_window->SetProperty(kMusWindow, window_); |
689 | 690 |
| 691 // TODO(moshayedi): crbug.com/641039. Investigate whether there are any cases |
| 692 // where we need input method but don't have the WindowManagerConnection here. |
| 693 if (WindowManagerConnection::Exists()) { |
| 694 window_tree_host_->InitInputMethod( |
| 695 WindowManagerConnection::Get()->connector()); |
| 696 } |
| 697 |
690 focus_client_.reset( | 698 focus_client_.reset( |
691 new FocusControllerMus(new FocusRulesImpl(hosted_window))); | 699 new FocusControllerMus(new FocusRulesImpl(hosted_window))); |
692 | 700 |
693 aura::client::SetFocusClient(hosted_window, focus_client_.get()); | 701 aura::client::SetFocusClient(hosted_window, focus_client_.get()); |
694 aura::client::SetActivationClient(hosted_window, focus_client_.get()); | 702 aura::client::SetActivationClient(hosted_window, focus_client_.get()); |
695 screen_position_client_.reset(new ScreenPositionClientMus(window_)); | 703 screen_position_client_.reset(new ScreenPositionClientMus(window_)); |
696 aura::client::SetScreenPositionClient(hosted_window, | 704 aura::client::SetScreenPositionClient(hosted_window, |
697 screen_position_client_.get()); | 705 screen_position_client_.get()); |
698 | 706 |
699 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's | 707 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 | 1437 |
1430 gfx::Path mask_path; | 1438 gfx::Path mask_path; |
1431 native_widget_delegate_->GetHitTestMask(&mask_path); | 1439 native_widget_delegate_->GetHitTestMask(&mask_path); |
1432 // TODO(jamescook): Use the full path for the mask. | 1440 // TODO(jamescook): Use the full path for the mask. |
1433 gfx::Rect mask_rect = | 1441 gfx::Rect mask_rect = |
1434 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1442 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1435 window_->SetHitTestMask(mask_rect); | 1443 window_->SetHitTestMask(mask_rect); |
1436 } | 1444 } |
1437 | 1445 |
1438 } // namespace views | 1446 } // namespace views |
OLD | NEW |