| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 12 #import "base/mac/sdk_forward_declarations.h" | 12 #import "base/mac/sdk_forward_declarations.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" | 14 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" |
| 15 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 16 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
| 17 #include "ui/base/ime/input_method_factory.h" | 17 #include "ui/base/ime/input_method_factory.h" |
| 18 #include "ui/base/ui_base_switches_util.h" | |
| 19 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 20 #include "ui/gfx/geometry/dip_util.h" | 19 #include "ui/gfx/geometry/dip_util.h" |
| 21 #import "ui/gfx/mac/coordinate_conversion.h" | 20 #import "ui/gfx/mac/coordinate_conversion.h" |
| 22 #import "ui/gfx/mac/nswindow_frame_controls.h" | 21 #import "ui/gfx/mac/nswindow_frame_controls.h" |
| 23 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 24 #import "ui/views/cocoa/bridged_content_view.h" | 23 #import "ui/views/cocoa/bridged_content_view.h" |
| 25 #import "ui/views/cocoa/cocoa_mouse_capture.h" | 24 #import "ui/views/cocoa/cocoa_mouse_capture.h" |
| 26 #include "ui/views/cocoa/tooltip_manager_mac.h" | 25 #include "ui/views/cocoa/tooltip_manager_mac.h" |
| 27 #import "ui/views/cocoa/views_nswindow_delegate.h" | 26 #import "ui/views/cocoa/views_nswindow_delegate.h" |
| 28 #import "ui/views/cocoa/widget_owner_nswindow_adapter.h" | 27 #import "ui/views/cocoa/widget_owner_nswindow_adapter.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 is_resizable && (min_size.IsEmpty() || min_size != max_size); | 701 is_resizable && (min_size.IsEmpty() || min_size != max_size); |
| 703 bool shows_fullscreen_controls = | 702 bool shows_fullscreen_controls = |
| 704 is_resizable && widget->widget_delegate()->CanMaximize(); | 703 is_resizable && widget->widget_delegate()->CanMaximize(); |
| 705 | 704 |
| 706 gfx::ApplyNSWindowSizeConstraints(window_, min_size, max_size, | 705 gfx::ApplyNSWindowSizeConstraints(window_, min_size, max_size, |
| 707 shows_resize_controls, | 706 shows_resize_controls, |
| 708 shows_fullscreen_controls); | 707 shows_fullscreen_controls); |
| 709 } | 708 } |
| 710 | 709 |
| 711 InputMethod* BridgedNativeWidget::CreateInputMethod() { | 710 InputMethod* BridgedNativeWidget::CreateInputMethod() { |
| 712 if (switches::IsTextInputFocusManagerEnabled()) | |
| 713 return new NullInputMethod(); | |
| 714 | |
| 715 return new InputMethodBridge(this, GetHostInputMethod(), true); | 711 return new InputMethodBridge(this, GetHostInputMethod(), true); |
| 716 } | 712 } |
| 717 | 713 |
| 718 ui::InputMethod* BridgedNativeWidget::GetHostInputMethod() { | 714 ui::InputMethod* BridgedNativeWidget::GetHostInputMethod() { |
| 719 if (!input_method_) { | 715 if (!input_method_) { |
| 720 // Delegate is NULL because Mac IME does not need DispatchKeyEventPostIME | 716 // Delegate is NULL because Mac IME does not need DispatchKeyEventPostIME |
| 721 // callbacks. | 717 // callbacks. |
| 722 input_method_ = ui::CreateInputMethod(NULL, nil); | 718 input_method_ = ui::CreateInputMethod(NULL, nil); |
| 723 } | 719 } |
| 724 return input_method_.get(); | 720 return input_method_.get(); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1025 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1030 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1026 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1031 // changes. Previously we tried adding an NSView and removing it, but for some | 1027 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1032 // reason it required reposting the mouse-down event, and didn't always work. | 1028 // reason it required reposting the mouse-down event, and didn't always work. |
| 1033 // Calling the below seems to be an effective solution. | 1029 // Calling the below seems to be an effective solution. |
| 1034 [window_ setMovableByWindowBackground:NO]; | 1030 [window_ setMovableByWindowBackground:NO]; |
| 1035 [window_ setMovableByWindowBackground:YES]; | 1031 [window_ setMovableByWindowBackground:YES]; |
| 1036 } | 1032 } |
| 1037 | 1033 |
| 1038 } // namespace views | 1034 } // namespace views |
| OLD | NEW |