| 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" |
| 11 #include "ui/aura/client/activation_client.h" | 11 #include "ui/aura/client/activation_client.h" |
| 12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
| 13 #include "ui/aura/client/drag_drop_client.h" | 13 #include "ui/aura/client/drag_drop_client.h" |
| 14 #include "ui/aura/client/screen_position_client.h" | 14 #include "ui/aura/client/screen_position_client.h" |
| 15 #include "ui/aura/client/stacking_client.h" | 15 #include "ui/aura/client/stacking_client.h" |
| 16 #include "ui/aura/client/window_move_client.h" | 16 #include "ui/aura/client/window_move_client.h" |
| 17 #include "ui/aura/client/window_types.h" | 17 #include "ui/aura/client/window_types.h" |
| 18 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
| 19 #include "ui/aura/event.h" | 19 #include "ui/aura/event.h" |
| 20 #include "ui/aura/focus_manager.h" | 20 #include "ui/aura/focus_manager.h" |
| 21 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_observer.h" | 23 #include "ui/aura/window_observer.h" |
| 24 #include "ui/base/accelerators/accelerator.h" |
| 24 #include "ui/base/dragdrop/os_exchange_data.h" | 25 #include "ui/base/dragdrop/os_exchange_data.h" |
| 25 #include "ui/base/ui_base_types.h" | 26 #include "ui/base/ui_base_types.h" |
| 26 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
| 27 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
| 28 #include "ui/gfx/font.h" | 29 #include "ui/gfx/font.h" |
| 29 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 30 #include "ui/views/drag_utils.h" | 31 #include "ui/views/drag_utils.h" |
| 31 #include "ui/views/ime/input_method_bridge.h" | 32 #include "ui/views/ime/input_method_bridge.h" |
| 32 #include "ui/views/views_delegate.h" | 33 #include "ui/views/views_delegate.h" |
| 33 #include "ui/views/widget/drop_helper.h" | 34 #include "ui/views/widget/drop_helper.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); | 685 window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); |
| 685 } | 686 } |
| 686 | 687 |
| 687 //////////////////////////////////////////////////////////////////////////////// | 688 //////////////////////////////////////////////////////////////////////////////// |
| 688 // NativeWidgetAura, views::InputMethodDelegate implementation: | 689 // NativeWidgetAura, views::InputMethodDelegate implementation: |
| 689 | 690 |
| 690 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 691 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { |
| 691 FocusManager* focus_manager = GetWidget()->GetFocusManager(); | 692 FocusManager* focus_manager = GetWidget()->GetFocusManager(); |
| 692 if (focus_manager) | 693 if (focus_manager) |
| 693 focus_manager->MaybeResetMenuKeyState(key); | 694 focus_manager->MaybeResetMenuKeyState(key); |
| 694 if (delegate_->OnKeyEvent(key) || !focus_manager) | 695 const bool consumed = delegate_->OnKeyEvent(key); |
| 696 if (!consumed && focus_manager) |
| 697 focus_manager->OnKeyEvent(key); |
| 698 if (!focus_manager) |
| 695 return; | 699 return; |
| 696 focus_manager->OnKeyEvent(key); | 700 ui::Accelerator accelerator(key.key_code(), |
| 701 key.IsShiftDown(), |
| 702 key.IsControlDown(), |
| 703 key.IsAltDown()); |
| 704 accelerator.set_type(key.type()); |
| 705 focus_manager->accelerator_manager()->set_last_event(accelerator); |
| 697 } | 706 } |
| 698 | 707 |
| 699 //////////////////////////////////////////////////////////////////////////////// | 708 //////////////////////////////////////////////////////////////////////////////// |
| 700 // NativeWidgetAura, aura::WindowDelegate implementation: | 709 // NativeWidgetAura, aura::WindowDelegate implementation: |
| 701 | 710 |
| 702 gfx::Size NativeWidgetAura::GetMinimumSize() const { | 711 gfx::Size NativeWidgetAura::GetMinimumSize() const { |
| 703 return delegate_->GetMinimumSize(); | 712 return delegate_->GetMinimumSize(); |
| 704 } | 713 } |
| 705 | 714 |
| 706 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 715 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 return aura::Env::GetInstance()->is_mouse_button_down(); | 1057 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 1049 } | 1058 } |
| 1050 | 1059 |
| 1051 // static | 1060 // static |
| 1052 bool NativeWidgetPrivate::IsTouchDown() { | 1061 bool NativeWidgetPrivate::IsTouchDown() { |
| 1053 return aura::Env::GetInstance()->is_touch_down(); | 1062 return aura::Env::GetInstance()->is_touch_down(); |
| 1054 } | 1063 } |
| 1055 | 1064 |
| 1056 } // namespace internal | 1065 } // namespace internal |
| 1057 } // namespace views | 1066 } // namespace views |
| OLD | NEW |