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