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/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/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 // If a ui::InputMethod object is attached to the root window, character | 853 // If a ui::InputMethod object is attached to the root window, character |
854 // events are handled inside the object and are not passed to this function. | 854 // events are handled inside the object and are not passed to this function. |
855 // If such object is not attached, character events might be sent (e.g. on | 855 // If such object is not attached, character events might be sent (e.g. on |
856 // Windows). In this case, we just skip these. | 856 // Windows). In this case, we just skip these. |
857 return; | 857 return; |
858 } | 858 } |
859 // Renderer may send a key event back to us if the key event wasn't handled, | 859 // Renderer may send a key event back to us if the key event wasn't handled, |
860 // and the window may be invisible by that time. | 860 // and the window may be invisible by that time. |
861 if (!window_->IsVisible()) | 861 if (!window_->IsVisible()) |
862 return; | 862 return; |
863 GetWidget()->GetInputMethod()->DispatchKeyEvent(*event); | 863 InputMethod* input_method = GetWidget()->GetInputMethod(); |
| 864 if (!input_method) |
| 865 return; |
| 866 input_method->DispatchKeyEvent(*event); |
864 if (switches::IsTextInputFocusManagerEnabled()) { | 867 if (switches::IsTextInputFocusManagerEnabled()) { |
865 FocusManager* focus_manager = GetWidget()->GetFocusManager(); | 868 FocusManager* focus_manager = GetWidget()->GetFocusManager(); |
866 delegate_->OnKeyEvent(event); | 869 delegate_->OnKeyEvent(event); |
867 if (!event->handled() && focus_manager) | 870 if (!event->handled() && focus_manager) |
868 focus_manager->OnKeyEvent(*event); | 871 focus_manager->OnKeyEvent(*event); |
869 } | 872 } |
870 event->SetHandled(); | 873 event->SetHandled(); |
871 } | 874 } |
872 | 875 |
873 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { | 876 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1175 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
1173 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1176 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
1174 return gfx::FontList(gfx::Font(caption_font)); | 1177 return gfx::FontList(gfx::Font(caption_font)); |
1175 #else | 1178 #else |
1176 return gfx::FontList(); | 1179 return gfx::FontList(); |
1177 #endif | 1180 #endif |
1178 } | 1181 } |
1179 | 1182 |
1180 } // namespace internal | 1183 } // namespace internal |
1181 } // namespace views | 1184 } // namespace views |
OLD | NEW |