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/string_util.h" | 8 #include "base/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_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
683 void NativeWidgetAura::SetVisibilityChangedAnimationsEnabled(bool value) { | 683 void NativeWidgetAura::SetVisibilityChangedAnimationsEnabled(bool value) { |
684 window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); | 684 window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); |
685 } | 685 } |
686 | 686 |
687 //////////////////////////////////////////////////////////////////////////////// | 687 //////////////////////////////////////////////////////////////////////////////// |
688 // NativeWidgetAura, views::InputMethodDelegate implementation: | 688 // NativeWidgetAura, views::InputMethodDelegate implementation: |
689 | 689 |
690 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 690 void NativeWidgetAura::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
691 FocusManager* focus_manager = GetWidget()->GetFocusManager(); | 691 FocusManager* focus_manager = GetWidget()->GetFocusManager(); |
692 if (focus_manager) | 692 if (focus_manager) |
693 focus_manager->MaybeResetMenuKeyState(key); | 693 focus_manager->MaybeResetMenuKeyState(key); |
694 if (delegate_->OnKeyEvent(key) || !focus_manager) | 694 if (delegate_->OnKeyEvent(key) || !focus_manager) |
695 return; | 695 return; |
696 focus_manager->OnKeyEvent(key); | 696 focus_manager->OnKeyEvent(key); |
697 } | 697 } |
698 | 698 |
699 //////////////////////////////////////////////////////////////////////////////// | 699 //////////////////////////////////////////////////////////////////////////////// |
700 // NativeWidgetAura, aura::WindowDelegate implementation: | 700 // NativeWidgetAura, aura::WindowDelegate implementation: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // If a ui::InputMethod object is attached to the root window, character | 739 // If a ui::InputMethod object is attached to the root window, character |
740 // events are handled inside the object and are not passed to this function. | 740 // events are handled inside the object and are not passed to this function. |
741 // If such object is not attached, character events might be sent (e.g. on | 741 // If such object is not attached, character events might be sent (e.g. on |
742 // Windows). In this case, we just skip these. | 742 // Windows). In this case, we just skip these. |
743 return false; | 743 return false; |
744 } | 744 } |
745 // Renderer may send a key event back to us if the key event wasn't handled, | 745 // Renderer may send a key event back to us if the key event wasn't handled, |
746 // and the window may be invisible by that time. | 746 // and the window may be invisible by that time. |
747 if (!window_->IsVisible()) | 747 if (!window_->IsVisible()) |
748 return false; | 748 return false; |
749 InputMethod* input_method = GetWidget()->GetInputMethod(); | 749 GetWidget()->GetInputMethod()->DispatchKeyEvent(*event); |
750 DCHECK(input_method); | |
751 KeyEvent views_event(event); | |
752 input_method->DispatchKeyEvent(views_event); | |
753 return true; | 750 return true; |
754 } | 751 } |
755 | 752 |
756 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { | 753 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { |
757 return cursor_; | 754 return cursor_; |
758 } | 755 } |
759 | 756 |
760 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { | 757 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { |
761 return delegate_->GetNonClientComponent(point); | 758 return delegate_->GetNonClientComponent(point); |
762 } | 759 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 return aura::Env::GetInstance()->is_mouse_button_down(); | 1046 return aura::Env::GetInstance()->is_mouse_button_down(); |
1050 } | 1047 } |
1051 | 1048 |
1052 // static | 1049 // static |
1053 bool NativeWidgetPrivate::IsTouchDown() { | 1050 bool NativeWidgetPrivate::IsTouchDown() { |
1054 return aura::Env::GetInstance()->is_touch_down(); | 1051 return aura::Env::GetInstance()->is_touch_down(); |
1055 } | 1052 } |
1056 | 1053 |
1057 } // namespace internal | 1054 } // namespace internal |
1058 } // namespace views | 1055 } // namespace views |
OLD | NEW |