| 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" |
| 11 #include "ui/aura/client/cursor_client.h" | 11 #include "ui/aura/client/cursor_client.h" |
| 12 #include "ui/aura/client/focus_client.h" | 12 #include "ui/aura/client/focus_client.h" |
| 13 #include "ui/aura/client/screen_position_client.h" | 13 #include "ui/aura/client/screen_position_client.h" |
| 14 #include "ui/aura/client/window_tree_client.h" | 14 #include "ui/aura/client/window_tree_client.h" |
| 15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 19 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
| 20 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
| 21 #include "ui/base/ui_base_switches_util.h" | |
| 22 #include "ui/base/ui_base_types.h" | 21 #include "ui/base/ui_base_types.h" |
| 23 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 24 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
| 25 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 26 #include "ui/gfx/font_list.h" | 25 #include "ui/gfx/font_list.h" |
| 27 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
| 28 #include "ui/native_theme/native_theme_aura.h" | 27 #include "ui/native_theme/native_theme_aura.h" |
| 29 #include "ui/views/drag_utils.h" | 28 #include "ui/views/drag_utils.h" |
| 30 #include "ui/views/ime/input_method_bridge.h" | 29 #include "ui/views/ime/input_method_bridge.h" |
| 31 #include "ui/views/ime/null_input_method.h" | 30 #include "ui/views/ime/null_input_method.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 263 } |
| 265 | 264 |
| 266 bool NativeWidgetAura::HasCapture() const { | 265 bool NativeWidgetAura::HasCapture() const { |
| 267 return window_ && window_->HasCapture(); | 266 return window_ && window_->HasCapture(); |
| 268 } | 267 } |
| 269 | 268 |
| 270 InputMethod* NativeWidgetAura::CreateInputMethod() { | 269 InputMethod* NativeWidgetAura::CreateInputMethod() { |
| 271 if (!window_) | 270 if (!window_) |
| 272 return NULL; | 271 return NULL; |
| 273 | 272 |
| 274 if (switches::IsTextInputFocusManagerEnabled()) | |
| 275 return new NullInputMethod(); | |
| 276 | |
| 277 return new InputMethodBridge(this, GetHostInputMethod(), true); | 273 return new InputMethodBridge(this, GetHostInputMethod(), true); |
| 278 } | 274 } |
| 279 | 275 |
| 280 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() { | 276 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() { |
| 281 return this; | 277 return this; |
| 282 } | 278 } |
| 283 | 279 |
| 284 ui::InputMethod* NativeWidgetAura::GetHostInputMethod() { | 280 ui::InputMethod* NativeWidgetAura::GetHostInputMethod() { |
| 285 aura::Window* root_window = window_->GetRootWindow(); | 281 aura::Window* root_window = window_->GetRootWindow(); |
| 286 return root_window->GetHost()->GetInputMethod(); | 282 return root_window->GetHost()->GetInputMethod(); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 return; | 878 return; |
| 883 } | 879 } |
| 884 // Renderer may send a key event back to us if the key event wasn't handled, | 880 // Renderer may send a key event back to us if the key event wasn't handled, |
| 885 // and the window may be invisible by that time. | 881 // and the window may be invisible by that time. |
| 886 if (!window_->IsVisible()) | 882 if (!window_->IsVisible()) |
| 887 return; | 883 return; |
| 888 InputMethod* input_method = GetWidget()->GetInputMethod(); | 884 InputMethod* input_method = GetWidget()->GetInputMethod(); |
| 889 if (!input_method) | 885 if (!input_method) |
| 890 return; | 886 return; |
| 891 input_method->DispatchKeyEvent(*event); | 887 input_method->DispatchKeyEvent(*event); |
| 892 if (switches::IsTextInputFocusManagerEnabled()) { | |
| 893 FocusManager* focus_manager = GetWidget()->GetFocusManager(); | |
| 894 delegate_->OnKeyEvent(event); | |
| 895 if (!event->handled() && focus_manager) | |
| 896 focus_manager->OnKeyEvent(*event); | |
| 897 } | |
| 898 event->SetHandled(); | 888 event->SetHandled(); |
| 899 } | 889 } |
| 900 | 890 |
| 901 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { | 891 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { |
| 902 DCHECK(window_); | 892 DCHECK(window_); |
| 903 DCHECK(window_->IsVisible()); | 893 DCHECK(window_->IsVisible()); |
| 904 if (event->type() == ui::ET_MOUSEWHEEL) { | 894 if (event->type() == ui::ET_MOUSEWHEEL) { |
| 905 delegate_->OnMouseEvent(event); | 895 delegate_->OnMouseEvent(event); |
| 906 if (event->handled()) | 896 if (event->handled()) |
| 907 return; | 897 return; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1194 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
| 1205 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1195 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
| 1206 return gfx::FontList(gfx::Font(caption_font)); | 1196 return gfx::FontList(gfx::Font(caption_font)); |
| 1207 #else | 1197 #else |
| 1208 return gfx::FontList(); | 1198 return gfx::FontList(); |
| 1209 #endif | 1199 #endif |
| 1210 } | 1200 } |
| 1211 | 1201 |
| 1212 } // namespace internal | 1202 } // namespace internal |
| 1213 } // namespace views | 1203 } // namespace views |
| OLD | NEW |