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/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 const Widget* toplevel = GetTopLevelWidget(); | 781 const Widget* toplevel = GetTopLevelWidget(); |
782 // If GetTopLevelWidget() returns itself which is not toplevel, | 782 // If GetTopLevelWidget() returns itself which is not toplevel, |
783 // the widget is detached from toplevel widget. | 783 // the widget is detached from toplevel widget. |
784 // TODO(oshima): Fix GetTopLevelWidget() to return NULL | 784 // TODO(oshima): Fix GetTopLevelWidget() to return NULL |
785 // if there is no toplevel. We probably need to add GetTopMostWidget() | 785 // if there is no toplevel. We probably need to add GetTopMostWidget() |
786 // to replace some use cases. | 786 // to replace some use cases. |
787 return (toplevel && toplevel != this) ? toplevel->GetInputMethod() : NULL; | 787 return (toplevel && toplevel != this) ? toplevel->GetInputMethod() : NULL; |
788 } | 788 } |
789 } | 789 } |
790 | 790 |
| 791 ui::InputMethod* Widget::GetHostInputMethod() { |
| 792 return native_widget_private()->GetHostInputMethod(); |
| 793 } |
| 794 |
791 void Widget::RunShellDrag(View* view, | 795 void Widget::RunShellDrag(View* view, |
792 const ui::OSExchangeData& data, | 796 const ui::OSExchangeData& data, |
793 const gfx::Point& location, | 797 const gfx::Point& location, |
794 int operation, | 798 int operation, |
795 ui::DragDropTypes::DragEventSource source) { | 799 ui::DragDropTypes::DragEventSource source) { |
796 dragged_view_ = view; | 800 dragged_view_ = view; |
797 native_widget_->RunShellDrag(view, data, location, operation, source); | 801 native_widget_->RunShellDrag(view, data, location, operation, source); |
798 // If the view is removed during the drag operation, dragged_view_ is set to | 802 // If the view is removed during the drag operation, dragged_view_ is set to |
799 // NULL. | 803 // NULL. |
800 if (view && dragged_view_ == view) { | 804 if (view && dragged_view_ == view) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 SaveWindowPlacement(); | 1026 SaveWindowPlacement(); |
1023 | 1027 |
1024 FOR_EACH_OBSERVER(WidgetObserver, observers_, | 1028 FOR_EACH_OBSERVER(WidgetObserver, observers_, |
1025 OnWidgetActivationChanged(this, active)); | 1029 OnWidgetActivationChanged(this, active)); |
1026 | 1030 |
1027 if (IsVisible() && non_client_view()) | 1031 if (IsVisible() && non_client_view()) |
1028 non_client_view()->frame_view()->SchedulePaint(); | 1032 non_client_view()->frame_view()->SchedulePaint(); |
1029 } | 1033 } |
1030 | 1034 |
1031 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) { | 1035 void Widget::OnNativeFocus(gfx::NativeView old_focused_view) { |
| 1036 // Ensure the focused view's TextInputClient is used for text input. |
| 1037 views::FocusManager* focus_manager = GetFocusManager(); |
| 1038 focus_manager->FocusTextInputClient(focus_manager->GetFocusedView()); |
| 1039 |
1032 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view, | 1040 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(old_focused_view, |
1033 GetNativeView()); | 1041 GetNativeView()); |
1034 } | 1042 } |
1035 | 1043 |
1036 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) { | 1044 void Widget::OnNativeBlur(gfx::NativeView new_focused_view) { |
| 1045 // Ensure the focused view's TextInputClient is not used for text input. |
| 1046 views::FocusManager* focus_manager = GetFocusManager(); |
| 1047 focus_manager->BlurTextInputClient(focus_manager->GetFocusedView()); |
| 1048 |
1037 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(GetNativeView(), | 1049 WidgetFocusManager::GetInstance()->OnWidgetFocusEvent(GetNativeView(), |
1038 new_focused_view); | 1050 new_focused_view); |
1039 } | 1051 } |
1040 | 1052 |
1041 void Widget::OnNativeWidgetVisibilityChanging(bool visible) { | 1053 void Widget::OnNativeWidgetVisibilityChanging(bool visible) { |
1042 FOR_EACH_OBSERVER(WidgetObserver, observers_, | 1054 FOR_EACH_OBSERVER(WidgetObserver, observers_, |
1043 OnWidgetVisibilityChanging(this, visible)); | 1055 OnWidgetVisibilityChanging(this, visible)); |
1044 } | 1056 } |
1045 | 1057 |
1046 void Widget::OnNativeWidgetVisibilityChanged(bool visible) { | 1058 void Widget::OnNativeWidgetVisibilityChanged(bool visible) { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 | 1496 |
1485 //////////////////////////////////////////////////////////////////////////////// | 1497 //////////////////////////////////////////////////////////////////////////////// |
1486 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1498 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1487 | 1499 |
1488 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1500 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1489 return this; | 1501 return this; |
1490 } | 1502 } |
1491 | 1503 |
1492 } // namespace internal | 1504 } // namespace internal |
1493 } // namespace views | 1505 } // namespace views |
OLD | NEW |