Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1079)

Side by Side Diff: views/widget/widget.cc

Issue 7729007: Focus/InputMethod fix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/native_widget_gtk.cc ('k') | views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 589 }
590 return default_theme_provider_.get(); 590 return default_theme_provider_.get();
591 } 591 }
592 592
593 FocusManager* Widget::GetFocusManager() { 593 FocusManager* Widget::GetFocusManager() {
594 Widget* toplevel_widget = GetTopLevelWidget(); 594 Widget* toplevel_widget = GetTopLevelWidget();
595 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL; 595 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL;
596 } 596 }
597 597
598 InputMethod* Widget::GetInputMethod() { 598 InputMethod* Widget::GetInputMethod() {
599 Widget* toplevel_widget = GetTopLevelWidget(); 599 if (is_top_level()) {
600 return toplevel_widget ? toplevel_widget->GetInputMethodDirect() : NULL; 600 if (!input_method_.get())
601 ReplaceInputMethod(native_widget_->CreateInputMethod());
602 return input_method_.get();
603 } else {
604 Widget* toplevel = GetTopLevelWidget();
605 return toplevel ? toplevel->GetInputMethod() : NULL;
606 }
601 } 607 }
602 608
603 void Widget::RunShellDrag(View* view, const ui::OSExchangeData& data, 609 void Widget::RunShellDrag(View* view, const ui::OSExchangeData& data,
604 int operation) { 610 int operation) {
605 dragged_view_ = view; 611 dragged_view_ = view;
606 native_widget_->RunShellDrag(view, data, operation); 612 native_widget_->RunShellDrag(view, data, operation);
607 // If the view is removed during the drag operation, dragged_view_ is set to 613 // If the view is removed during the drag operation, dragged_view_ is set to
608 // NULL. 614 // NULL.
609 if (view && dragged_view_ == view) { 615 if (view && dragged_view_ == view) {
610 dragged_view_ = NULL; 616 dragged_view_ = NULL;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 ui::TouchStatus Widget::OnTouchEvent(const TouchEvent& event) { 975 ui::TouchStatus Widget::OnTouchEvent(const TouchEvent& event) {
970 ScopedEvent scoped(this, event); 976 ScopedEvent scoped(this, event);
971 return static_cast<internal::RootView*>(GetRootView())->OnTouchEvent(event); 977 return static_cast<internal::RootView*>(GetRootView())->OnTouchEvent(event);
972 } 978 }
973 979
974 bool Widget::ExecuteCommand(int command_id) { 980 bool Widget::ExecuteCommand(int command_id) {
975 return widget_delegate_->ExecuteWindowsCommand(command_id); 981 return widget_delegate_->ExecuteWindowsCommand(command_id);
976 } 982 }
977 983
978 InputMethod* Widget::GetInputMethodDirect() { 984 InputMethod* Widget::GetInputMethodDirect() {
979 if (!input_method_.get() && is_top_level())
980 ReplaceInputMethod(native_widget_->CreateInputMethod());
981 return input_method_.get(); 985 return input_method_.get();
982 } 986 }
983 987
984 Widget* Widget::AsWidget() { 988 Widget* Widget::AsWidget() {
985 return this; 989 return this;
986 } 990 }
987 991
988 const Widget* Widget::AsWidget() const { 992 const Widget* Widget::AsWidget() const {
989 return this; 993 return this;
990 } 994 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 1126
1123 //////////////////////////////////////////////////////////////////////////////// 1127 ////////////////////////////////////////////////////////////////////////////////
1124 // internal::NativeWidgetPrivate, NativeWidget implementation: 1128 // internal::NativeWidgetPrivate, NativeWidget implementation:
1125 1129
1126 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1130 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1127 return this; 1131 return this;
1128 } 1132 }
1129 1133
1130 } // namespace internal 1134 } // namespace internal
1131 } // namespace views 1135 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_gtk.cc ('k') | views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698