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

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

Issue 860983004: text input focus: Supports Window::GetFocusedTextInputClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | 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) 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // the root_view_ being removed. 432 // the root_view_ being removed.
433 if (focus_manager) 433 if (focus_manager)
434 focus_manager->ViewRemoved(root_view_.get()); 434 focus_manager->ViewRemoved(root_view_.get());
435 } 435 }
436 436
437 void Widget::NotifyNativeViewHierarchyChanged() { 437 void Widget::NotifyNativeViewHierarchyChanged() {
438 root_view_->NotifyNativeViewHierarchyChanged(); 438 root_view_->NotifyNativeViewHierarchyChanged();
439 } 439 }
440 440
441 void Widget::NotifyWillRemoveView(View* view) { 441 void Widget::NotifyWillRemoveView(View* view) {
442 FOR_EACH_OBSERVER(WidgetRemovalsObserver, 442 FOR_EACH_OBSERVER(WidgetRemovalsObserver,
443 removals_observers_, 443 removals_observers_,
444 OnWillRemoveView(this, view)); 444 OnWillRemoveView(this, view));
445 } 445 }
446 446
447 // Converted methods (see header) ---------------------------------------------- 447 // Converted methods (see header) ----------------------------------------------
448 448
449 Widget* Widget::GetTopLevelWidget() { 449 Widget* Widget::GetTopLevelWidget() {
450 return const_cast<Widget*>( 450 return const_cast<Widget*>(
451 static_cast<const Widget*>(this)->GetTopLevelWidget()); 451 static_cast<const Widget*>(this)->GetTopLevelWidget());
452 } 452 }
453 453
454 const Widget* Widget::GetTopLevelWidget() const { 454 const Widget* Widget::GetTopLevelWidget() const {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 FocusManager* Widget::GetFocusManager() { 749 FocusManager* Widget::GetFocusManager() {
750 Widget* toplevel_widget = GetTopLevelWidget(); 750 Widget* toplevel_widget = GetTopLevelWidget();
751 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL; 751 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL;
752 } 752 }
753 753
754 const FocusManager* Widget::GetFocusManager() const { 754 const FocusManager* Widget::GetFocusManager() const {
755 const Widget* toplevel_widget = GetTopLevelWidget(); 755 const Widget* toplevel_widget = GetTopLevelWidget();
756 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL; 756 return toplevel_widget ? toplevel_widget->focus_manager_.get() : NULL;
757 } 757 }
758 758
759 ui::TextInputClient* Widget::GetFocusedTextInputClient() {
760 FocusManager* focus_manager = GetFocusManager();
761 View* view = focus_manager ? focus_manager->GetFocusedView() : nullptr;
762 return view ? view->GetTextInputClient() : nullptr;
763 }
764
759 InputMethod* Widget::GetInputMethod() { 765 InputMethod* Widget::GetInputMethod() {
760 return const_cast<InputMethod*>( 766 return const_cast<InputMethod*>(
761 const_cast<const Widget*>(this)->GetInputMethod()); 767 const_cast<const Widget*>(this)->GetInputMethod());
762 } 768 }
763 769
764 const InputMethod* Widget::GetInputMethod() const { 770 const InputMethod* Widget::GetInputMethod() const {
765 if (is_top_level()) { 771 if (is_top_level()) {
766 if (!input_method_.get()) 772 if (!input_method_.get())
767 input_method_ = const_cast<Widget*>(this)->CreateInputMethod().Pass(); 773 input_method_ = const_cast<Widget*>(this)->CreateInputMethod().Pass();
768 return input_method_.get(); 774 return input_method_.get();
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 1534
1529 //////////////////////////////////////////////////////////////////////////////// 1535 ////////////////////////////////////////////////////////////////////////////////
1530 // internal::NativeWidgetPrivate, NativeWidget implementation: 1536 // internal::NativeWidgetPrivate, NativeWidget implementation:
1531 1537
1532 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1538 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1533 return this; 1539 return this;
1534 } 1540 }
1535 1541
1536 } // namespace internal 1542 } // namespace internal
1537 } // namespace views 1543 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698