OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/widget.h" | 5 #include "views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/l10n/l10n_font_util.h" | 10 #include "ui/base/l10n/l10n_font_util.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL; | 615 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL; |
616 } | 616 } |
617 | 617 |
618 InputMethod* Widget::GetInputMethod() { | 618 InputMethod* Widget::GetInputMethod() { |
619 if (is_top_level()) { | 619 if (is_top_level()) { |
620 if (!input_method_.get()) | 620 if (!input_method_.get()) |
621 input_method_.reset(native_widget_->CreateInputMethod()); | 621 input_method_.reset(native_widget_->CreateInputMethod()); |
622 return input_method_.get(); | 622 return input_method_.get(); |
623 } else { | 623 } else { |
624 Widget* toplevel = GetTopLevelWidget(); | 624 Widget* toplevel = GetTopLevelWidget(); |
625 return toplevel ? toplevel->GetInputMethod() : NULL; | 625 // If GetTopLevelWidget() returns itself which is not toplevel, |
626 // the widget is detached from toplevel widget. | |
627 // TODO(oshima): Fix GetTopLevelWidget() to return NULL | |
628 // if there is no toplevel. We probably need to add GetTopMostWidget() | |
629 // to replace some use cases. | |
630 return toplevel && toplevel != this ? toplevel->GetInputMethod() : NULL; | |
sky
2011/09/21 21:01:46
nit: parens around toplevel && toplevel != this
oshima
2011/09/22 01:17:19
Done.
| |
626 } | 631 } |
627 } | 632 } |
628 | 633 |
629 void Widget::RunShellDrag(View* view, const ui::OSExchangeData& data, | 634 void Widget::RunShellDrag(View* view, const ui::OSExchangeData& data, |
630 int operation) { | 635 int operation) { |
631 dragged_view_ = view; | 636 dragged_view_ = view; |
632 native_widget_->RunShellDrag(view, data, operation); | 637 native_widget_->RunShellDrag(view, data, operation); |
633 // If the view is removed during the drag operation, dragged_view_ is set to | 638 // If the view is removed during the drag operation, dragged_view_ is set to |
634 // NULL. | 639 // NULL. |
635 if (view && dragged_view_ == view) { | 640 if (view && dragged_view_ == view) { |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 | 1178 |
1174 //////////////////////////////////////////////////////////////////////////////// | 1179 //////////////////////////////////////////////////////////////////////////////// |
1175 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1180 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1176 | 1181 |
1177 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1182 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1178 return this; | 1183 return this; |
1179 } | 1184 } |
1180 | 1185 |
1181 } // namespace internal | 1186 } // namespace internal |
1182 } // namespace views | 1187 } // namespace views |
OLD | NEW |