| 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_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/system_monitor/system_monitor.h" | 14 #include "base/system_monitor/system_monitor.h" |
| 15 #include "base/win/scoped_gdi_object.h" | 15 #include "base/win/scoped_gdi_object.h" |
| 16 #include "base/win/win_util.h" | 16 #include "base/win/win_util.h" |
| 17 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 18 #include "ui/base/dragdrop/drag_drop_types.h" | 18 #include "ui/base/dragdrop/drag_drop_types.h" |
| 19 #include "ui/base/dragdrop/drag_source.h" | 19 #include "ui/base/dragdrop/drag_source.h" |
| 20 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
| 21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 22 #include "ui/base/event.h" |
| 22 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 23 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 23 #include "ui/base/l10n/l10n_util_win.h" | 24 #include "ui/base/l10n/l10n_util_win.h" |
| 24 #include "ui/base/native_theme/native_theme_win.h" | 25 #include "ui/base/native_theme/native_theme_win.h" |
| 25 #include "ui/base/theme_provider.h" | 26 #include "ui/base/theme_provider.h" |
| 26 #include "ui/base/view_prop.h" | 27 #include "ui/base/view_prop.h" |
| 27 #include "ui/base/win/hwnd_util.h" | 28 #include "ui/base/win/hwnd_util.h" |
| 28 #include "ui/base/win/mouse_wheel_util.h" | 29 #include "ui/base/win/mouse_wheel_util.h" |
| 29 #include "ui/gfx/canvas.h" | 30 #include "ui/gfx/canvas.h" |
| 30 #include "ui/gfx/canvas_paint.h" | 31 #include "ui/gfx/canvas_paint.h" |
| 31 #include "ui/gfx/canvas_skia_paint.h" | 32 #include "ui/gfx/canvas_skia_paint.h" |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 if (input_method && !input_method->IsMock()) { | 1541 if (input_method && !input_method->IsMock()) { |
| 1541 static_cast<InputMethodWin*>(input_method)->OnInputLangChange( | 1542 static_cast<InputMethodWin*>(input_method)->OnInputLangChange( |
| 1542 character_set, input_language_id); | 1543 character_set, input_language_id); |
| 1543 } | 1544 } |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 LRESULT NativeWidgetWin::OnKeyEvent(UINT message, | 1547 LRESULT NativeWidgetWin::OnKeyEvent(UINT message, |
| 1547 WPARAM w_param, | 1548 WPARAM w_param, |
| 1548 LPARAM l_param) { | 1549 LPARAM l_param) { |
| 1549 MSG msg = { hwnd(), message, w_param, l_param }; | 1550 MSG msg = { hwnd(), message, w_param, l_param }; |
| 1550 KeyEvent key(msg); | 1551 ui::KeyEvent key(msg, message == WM_CHAR); |
| 1551 InputMethod* input_method = GetWidget()->GetInputMethodDirect(); | 1552 InputMethod* input_method = GetWidget()->GetInputMethodDirect(); |
| 1552 if (input_method) | 1553 if (input_method) |
| 1553 input_method->DispatchKeyEvent(key); | 1554 input_method->DispatchKeyEvent(key); |
| 1554 else | 1555 else |
| 1555 DispatchKeyEventPostIME(key); | 1556 DispatchKeyEventPostIME(key); |
| 1556 return 0; | 1557 return 0; |
| 1557 } | 1558 } |
| 1558 | 1559 |
| 1559 void NativeWidgetWin::OnKillFocus(HWND focused_window) { | 1560 void NativeWidgetWin::OnKillFocus(HWND focused_window) { |
| 1560 delegate_->OnNativeBlur(focused_window); | 1561 delegate_->OnNativeBlur(focused_window); |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 | 2596 |
| 2596 void NativeWidgetWin::NotifyOwnedWindowsParentClosing() { | 2597 void NativeWidgetWin::NotifyOwnedWindowsParentClosing() { |
| 2597 FindOwnedWindowsData data; | 2598 FindOwnedWindowsData data; |
| 2598 data.window = hwnd(); | 2599 data.window = hwnd(); |
| 2599 EnumThreadWindows(GetCurrentThreadId(), FindOwnedWindowsCallback, | 2600 EnumThreadWindows(GetCurrentThreadId(), FindOwnedWindowsCallback, |
| 2600 reinterpret_cast<LPARAM>(&data)); | 2601 reinterpret_cast<LPARAM>(&data)); |
| 2601 for (size_t i = 0; i < data.owned_widgets.size(); ++i) | 2602 for (size_t i = 0; i < data.owned_widgets.size(); ++i) |
| 2602 data.owned_widgets[i]->OnOwnerClosing(); | 2603 data.owned_widgets[i]->OnOwnerClosing(); |
| 2603 } | 2604 } |
| 2604 | 2605 |
| 2605 void NativeWidgetWin::DispatchKeyEventPostIME(const KeyEvent& key) { | 2606 void NativeWidgetWin::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
| 2606 SetMsgHandled(delegate_->OnKeyEvent(key)); | 2607 SetMsgHandled(delegate_->OnKeyEvent(key)); |
| 2607 } | 2608 } |
| 2608 | 2609 |
| 2609 //////////////////////////////////////////////////////////////////////////////// | 2610 //////////////////////////////////////////////////////////////////////////////// |
| 2610 // Widget, public: | 2611 // Widget, public: |
| 2611 | 2612 |
| 2612 // static | 2613 // static |
| 2613 void Widget::NotifyLocaleChanged() { | 2614 void Widget::NotifyLocaleChanged() { |
| 2614 NOTIMPLEMENTED(); | 2615 NOTIMPLEMENTED(); |
| 2615 } | 2616 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 // static | 2770 // static |
| 2770 bool NativeWidgetPrivate::IsTouchDown() { | 2771 bool NativeWidgetPrivate::IsTouchDown() { |
| 2771 // This currently isn't necessary because we're not generating touch events on | 2772 // This currently isn't necessary because we're not generating touch events on |
| 2772 // windows. When we do, this will need to be updated. | 2773 // windows. When we do, this will need to be updated. |
| 2773 return false; | 2774 return false; |
| 2774 } | 2775 } |
| 2775 | 2776 |
| 2776 } // namespace internal | 2777 } // namespace internal |
| 2777 | 2778 |
| 2778 } // namespace views | 2779 } // namespace views |
| OLD | NEW |