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" | |
36 #include "ui/views/mus/window_manager_constants_converters.h" | 35 #include "ui/views/mus/window_manager_constants_converters.h" |
37 #include "ui/views/mus/window_manager_frame_values.h" | 36 #include "ui/views/mus/window_manager_frame_values.h" |
38 #include "ui/views/mus/window_tree_host_mus.h" | 37 #include "ui/views/mus/window_tree_host_mus.h" |
39 #include "ui/views/widget/native_widget_aura.h" | 38 #include "ui/views/widget/native_widget_aura.h" |
40 #include "ui/views/widget/widget_delegate.h" | 39 #include "ui/views/widget/widget_delegate.h" |
41 #include "ui/views/window/custom_frame_view.h" | 40 #include "ui/views/window/custom_frame_view.h" |
42 #include "ui/wm/core/base_focus_rules.h" | 41 #include "ui/wm/core/base_focus_rules.h" |
43 #include "ui/wm/core/capture_controller.h" | 42 #include "ui/wm/core/capture_controller.h" |
44 #include "ui/wm/core/cursor_manager.h" | 43 #include "ui/wm/core/cursor_manager.h" |
45 #include "ui/wm/core/default_screen_position_client.h" | 44 #include "ui/wm/core/default_screen_position_client.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 680 |
682 ownership_ = params.ownership; | 681 ownership_ = params.ownership; |
683 window_->SetCanFocus(params.activatable == | 682 window_->SetCanFocus(params.activatable == |
684 Widget::InitParams::ACTIVATABLE_YES); | 683 Widget::InitParams::ACTIVATABLE_YES); |
685 window_->SetCanAcceptEvents(params.accept_events); | 684 window_->SetCanAcceptEvents(params.accept_events); |
686 | 685 |
687 window_tree_host_->AddObserver(this); | 686 window_tree_host_->AddObserver(this); |
688 window_tree_host_->InitHost(); | 687 window_tree_host_->InitHost(); |
689 hosted_window->SetProperty(kMusWindow, window_); | 688 hosted_window->SetProperty(kMusWindow, window_); |
690 | 689 |
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 | |
698 focus_client_.reset( | 690 focus_client_.reset( |
699 new FocusControllerMus(new FocusRulesImpl(hosted_window))); | 691 new FocusControllerMus(new FocusRulesImpl(hosted_window))); |
700 | 692 |
701 aura::client::SetFocusClient(hosted_window, focus_client_.get()); | 693 aura::client::SetFocusClient(hosted_window, focus_client_.get()); |
702 aura::client::SetActivationClient(hosted_window, focus_client_.get()); | 694 aura::client::SetActivationClient(hosted_window, focus_client_.get()); |
703 screen_position_client_.reset(new ScreenPositionClientMus(window_)); | 695 screen_position_client_.reset(new ScreenPositionClientMus(window_)); |
704 aura::client::SetScreenPositionClient(hosted_window, | 696 aura::client::SetScreenPositionClient(hosted_window, |
705 screen_position_client_.get()); | 697 screen_position_client_.get()); |
706 | 698 |
707 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's | 699 // 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... |
1437 | 1429 |
1438 gfx::Path mask_path; | 1430 gfx::Path mask_path; |
1439 native_widget_delegate_->GetHitTestMask(&mask_path); | 1431 native_widget_delegate_->GetHitTestMask(&mask_path); |
1440 // TODO(jamescook): Use the full path for the mask. | 1432 // TODO(jamescook): Use the full path for the mask. |
1441 gfx::Rect mask_rect = | 1433 gfx::Rect mask_rect = |
1442 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1434 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1443 window_->SetHitTestMask(mask_rect); | 1435 window_->SetHitTestMask(mask_rect); |
1444 } | 1436 } |
1445 | 1437 |
1446 } // namespace views | 1438 } // namespace views |
OLD | NEW |