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/keycodes/keyboard_code_conversion_win.h" | 22 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
23 #include "ui/base/l10n/l10n_util_win.h" | 23 #include "ui/base/l10n/l10n_util_win.h" |
24 #include "ui/base/theme_provider.h" | 24 #include "ui/base/theme_provider.h" |
25 #include "ui/base/view_prop.h" | 25 #include "ui/base/view_prop.h" |
26 #include "ui/base/win/hwnd_util.h" | 26 #include "ui/base/win/hwnd_util.h" |
27 #include "ui/base/win/mouse_wheel_util.h" | 27 #include "ui/base/win/mouse_wheel_util.h" |
| 28 #include "ui/gfx/canvas.h" |
28 #include "ui/gfx/canvas_paint.h" | 29 #include "ui/gfx/canvas_paint.h" |
29 #include "ui/gfx/canvas_skia.h" | |
30 #include "ui/gfx/canvas_skia_paint.h" | 30 #include "ui/gfx/canvas_skia_paint.h" |
31 #include "ui/gfx/icon_util.h" | 31 #include "ui/gfx/icon_util.h" |
32 #include "ui/gfx/native_theme_win.h" | 32 #include "ui/gfx/native_theme_win.h" |
33 #include "ui/gfx/path.h" | 33 #include "ui/gfx/path.h" |
34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
35 #include "ui/views/accessibility/native_view_accessibility_win.h" | 35 #include "ui/views/accessibility/native_view_accessibility_win.h" |
36 #include "ui/views/controls/native_control_win.h" | 36 #include "ui/views/controls/native_control_win.h" |
37 #include "ui/views/controls/textfield/native_textfield_views.h" | 37 #include "ui/views/controls/textfield/native_textfield_views.h" |
38 #include "ui/views/focus/accelerator_handler.h" | 38 #include "ui/views/focus/accelerator_handler.h" |
39 #include "ui/views/focus/view_storage.h" | 39 #include "ui/views/focus/view_storage.h" |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 void NativeWidgetWin::ClientAreaSizeChanged() { | 2375 void NativeWidgetWin::ClientAreaSizeChanged() { |
2376 RECT r; | 2376 RECT r; |
2377 if (WidgetSizeIsClientSize()) | 2377 if (WidgetSizeIsClientSize()) |
2378 GetClientRect(&r); | 2378 GetClientRect(&r); |
2379 else | 2379 else |
2380 GetWindowRect(&r); | 2380 GetWindowRect(&r); |
2381 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 2381 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
2382 std::max(0, static_cast<int>(r.bottom - r.top))); | 2382 std::max(0, static_cast<int>(r.bottom - r.top))); |
2383 delegate_->OnNativeWidgetSizeChanged(s); | 2383 delegate_->OnNativeWidgetSizeChanged(s); |
2384 if (use_layered_buffer_) | 2384 if (use_layered_buffer_) |
2385 layered_window_contents_.reset(new gfx::CanvasSkia(s, false)); | 2385 layered_window_contents_.reset(new gfx::Canvas(s, false)); |
2386 } | 2386 } |
2387 | 2387 |
2388 void NativeWidgetWin::UpdateDWMFrame() { | 2388 void NativeWidgetWin::UpdateDWMFrame() { |
2389 MARGINS m = {10, 10, 10, 10}; | 2389 MARGINS m = {10, 10, 10, 10}; |
2390 DwmExtendFrameIntoClientArea(GetNativeView(), &m); | 2390 DwmExtendFrameIntoClientArea(GetNativeView(), &m); |
2391 } | 2391 } |
2392 | 2392 |
2393 void NativeWidgetWin::ResetWindowRegion(bool force) { | 2393 void NativeWidgetWin::ResetWindowRegion(bool force) { |
2394 // A native frame uses the native window region, and we don't want to mess | 2394 // A native frame uses the native window region, and we don't want to mess |
2395 // with it. | 2395 // with it. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2622 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2623 (GetKeyState(VK_RBUTTON) & 0x80) || | 2623 (GetKeyState(VK_RBUTTON) & 0x80) || |
2624 (GetKeyState(VK_MBUTTON) & 0x80) || | 2624 (GetKeyState(VK_MBUTTON) & 0x80) || |
2625 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2625 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2626 (GetKeyState(VK_XBUTTON2) & 0x80); | 2626 (GetKeyState(VK_XBUTTON2) & 0x80); |
2627 } | 2627 } |
2628 | 2628 |
2629 } // namespace internal | 2629 } // namespace internal |
2630 | 2630 |
2631 } // namespace views | 2631 } // namespace views |
OLD | NEW |