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

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

Issue 23245012: Fix Views Combobox and Tree View text input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanups. Created 7 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
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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/activation_client.h" 10 #include "ui/aura/client/activation_client.h"
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 881 }
882 882
883 //////////////////////////////////////////////////////////////////////////////// 883 ////////////////////////////////////////////////////////////////////////////////
884 // NativeWidgetAura, aura::client::FocusChangeObserver: 884 // NativeWidgetAura, aura::client::FocusChangeObserver:
885 885
886 void NativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, 886 void NativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
887 aura::Window* lost_focus) { 887 aura::Window* lost_focus) {
888 if (window_ == gained_focus) { 888 if (window_ == gained_focus) {
889 // In aura, it is possible for child native widgets to take input and focus, 889 // In aura, it is possible for child native widgets to take input and focus,
890 // this differs from the behavior on windows. 890 // this differs from the behavior on windows.
891 if (GetWidget()->GetInputMethod()) // Null in tests.
892 GetWidget()->GetInputMethod()->OnFocus();
893 delegate_->OnNativeFocus(lost_focus); 891 delegate_->OnNativeFocus(lost_focus);
894 } else if (window_ == lost_focus) { 892 } else if (window_ == lost_focus) {
895 // GetInputMethod() recreates the input method if it's previously been 893 if (destroying_) {
sky 2013/08/26 16:01:35 nit: no {}
msw 2013/08/26 16:28:33 Done.
896 // destroyed. If we get called during destruction, the input method will be
897 // gone, and creating a new one and telling it that we lost the focus will
898 // trigger a DCHECK (the new input method doesn't think that we have the
899 // focus and doesn't expect a blur). OnBlur() shouldn't be called during
900 // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the
901 // case in tests).
902 if (!destroying_) {
903 if (GetWidget()->GetInputMethod())
904 GetWidget()->GetInputMethod()->OnBlur();
905 } else {
906 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); 894 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET);
907 } 895 }
908 896
909 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); 897 aura::client::FocusClient* client = aura::client::GetFocusClient(window_);
910 if (client) // NULL during destruction of aura::Window. 898 if (client) // NULL during destruction of aura::Window.
911 delegate_->OnNativeBlur(client->GetFocusedWindow()); 899 delegate_->OnNativeBlur(client->GetFocusedWindow());
912 } 900 }
913 } 901 }
914 902
915 //////////////////////////////////////////////////////////////////////////////// 903 ////////////////////////////////////////////////////////////////////////////////
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 return aura::Env::GetInstance()->is_mouse_button_down(); 1111 return aura::Env::GetInstance()->is_mouse_button_down();
1124 } 1112 }
1125 1113
1126 // static 1114 // static
1127 bool NativeWidgetPrivate::IsTouchDown() { 1115 bool NativeWidgetPrivate::IsTouchDown() {
1128 return aura::Env::GetInstance()->is_touch_down(); 1116 return aura::Env::GetInstance()->is_touch_down();
1129 } 1117 }
1130 1118
1131 } // namespace internal 1119 } // namespace internal
1132 } // namespace views 1120 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698