OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
11 #include "ui/aura/client/focus_client.h" | 11 #include "ui/aura/client/focus_client.h" |
12 #include "ui/aura/client/window_tree_client.h" | 12 #include "ui/aura/client/window_tree_client.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 #include "ui/aura/window_property.h" | 15 #include "ui/aura/window_property.h" |
16 #include "ui/aura/window_tree_host.h" | 16 #include "ui/aura/window_tree_host.h" |
17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 18 #include "ui/base/ui_base_switches_util.h" |
18 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
21 #include "ui/gfx/point_conversions.h" | 22 #include "ui/gfx/point_conversions.h" |
22 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
23 #include "ui/gfx/size_conversions.h" | 24 #include "ui/gfx/size_conversions.h" |
24 #include "ui/native_theme/native_theme.h" | 25 #include "ui/native_theme/native_theme.h" |
25 #include "ui/views/corewm/tooltip.h" | 26 #include "ui/views/corewm/tooltip.h" |
26 #include "ui/views/corewm/tooltip_controller.h" | 27 #include "ui/views/corewm/tooltip_controller.h" |
27 #include "ui/views/drag_utils.h" | 28 #include "ui/views/drag_utils.h" |
28 #include "ui/views/ime/input_method.h" | |
29 #include "ui/views/ime/input_method_bridge.h" | 29 #include "ui/views/ime/input_method_bridge.h" |
| 30 #include "ui/views/ime/null_input_method.h" |
30 #include "ui/views/view_constants_aura.h" | 31 #include "ui/views/view_constants_aura.h" |
31 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" | 32 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" |
32 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" | 33 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" |
33 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 34 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
34 #include "ui/views/widget/desktop_aura/desktop_event_client.h" | 35 #include "ui/views/widget/desktop_aura/desktop_event_client.h" |
35 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | 36 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" |
36 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 37 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
37 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 38 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
38 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" | 39 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" |
39 #include "ui/views/widget/drop_helper.h" | 40 #include "ui/views/widget/drop_helper.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 622 |
622 content_window_->ReleaseCapture(); | 623 content_window_->ReleaseCapture(); |
623 } | 624 } |
624 | 625 |
625 bool DesktopNativeWidgetAura::HasCapture() const { | 626 bool DesktopNativeWidgetAura::HasCapture() const { |
626 return content_window_ && content_window_->HasCapture() && | 627 return content_window_ && content_window_->HasCapture() && |
627 desktop_window_tree_host_->HasCapture(); | 628 desktop_window_tree_host_->HasCapture(); |
628 } | 629 } |
629 | 630 |
630 InputMethod* DesktopNativeWidgetAura::CreateInputMethod() { | 631 InputMethod* DesktopNativeWidgetAura::CreateInputMethod() { |
| 632 if (switches::IsTextInputFocusManagerEnabled()) |
| 633 return new NullInputMethod(); |
| 634 |
631 ui::InputMethod* host = input_method_event_filter_->input_method(); | 635 ui::InputMethod* host = input_method_event_filter_->input_method(); |
632 return new InputMethodBridge(this, host, false); | 636 return new InputMethodBridge(this, host, false); |
633 } | 637 } |
634 | 638 |
635 internal::InputMethodDelegate* | 639 internal::InputMethodDelegate* |
636 DesktopNativeWidgetAura::GetInputMethodDelegate() { | 640 DesktopNativeWidgetAura::GetInputMethodDelegate() { |
637 return this; | 641 return this; |
638 } | 642 } |
639 | 643 |
| 644 ui::InputMethod* DesktopNativeWidgetAura::GetHostInputMethod() { |
| 645 return input_method_event_filter_->input_method(); |
| 646 } |
| 647 |
640 void DesktopNativeWidgetAura::CenterWindow(const gfx::Size& size) { | 648 void DesktopNativeWidgetAura::CenterWindow(const gfx::Size& size) { |
641 if (content_window_) | 649 if (content_window_) |
642 desktop_window_tree_host_->CenterWindow(size); | 650 desktop_window_tree_host_->CenterWindow(size); |
643 } | 651 } |
644 | 652 |
645 void DesktopNativeWidgetAura::GetWindowPlacement( | 653 void DesktopNativeWidgetAura::GetWindowPlacement( |
646 gfx::Rect* bounds, | 654 gfx::Rect* bounds, |
647 ui::WindowShowState* maximized) const { | 655 ui::WindowShowState* maximized) const { |
648 if (content_window_) | 656 if (content_window_) |
649 desktop_window_tree_host_->GetWindowPlacement(bounds, maximized); | 657 desktop_window_tree_host_->GetWindowPlacement(bounds, maximized); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 if (cursor_reference_count_ == 0) { | 1194 if (cursor_reference_count_ == 0) { |
1187 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1195 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1188 // for cleaning up |cursor_manager_|. | 1196 // for cleaning up |cursor_manager_|. |
1189 delete cursor_manager_; | 1197 delete cursor_manager_; |
1190 native_cursor_manager_ = NULL; | 1198 native_cursor_manager_ = NULL; |
1191 cursor_manager_ = NULL; | 1199 cursor_manager_ = NULL; |
1192 } | 1200 } |
1193 } | 1201 } |
1194 | 1202 |
1195 } // namespace views | 1203 } // namespace views |
OLD | NEW |