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/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/win/win_util.h" | 12 #include "base/win/win_util.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "ui/base/events/event.h" | 14 #include "ui/base/events/event.h" |
15 #include "ui/base/events/event_utils.h" | 15 #include "ui/base/events/event_utils.h" |
16 #include "ui/base/gestures/gesture_sequence.h" | 16 #include "ui/base/gestures/gesture_sequence.h" |
17 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 17 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 18 #include "ui/base/layout.h" |
18 #include "ui/base/touch/touch_enabled.h" | 19 #include "ui/base/touch/touch_enabled.h" |
19 #include "ui/base/win/mouse_wheel_util.h" | 20 #include "ui/base/win/mouse_wheel_util.h" |
20 #include "ui/base/win/shell.h" | 21 #include "ui/base/win/shell.h" |
21 #include "ui/base/win/touch_input.h" | 22 #include "ui/base/win/touch_input.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/canvas_skia_paint.h" | 24 #include "ui/gfx/canvas_skia_paint.h" |
24 #include "ui/gfx/icon_util.h" | 25 #include "ui/gfx/icon_util.h" |
25 #include "ui/gfx/insets.h" | 26 #include "ui/gfx/insets.h" |
26 #include "ui/gfx/path.h" | 27 #include "ui/gfx/path.h" |
27 #include "ui/gfx/path_win.h" | 28 #include "ui/gfx/path_win.h" |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 // GetClientAreaInsets for more details. | 1031 // GetClientAreaInsets for more details. |
1031 if (remove_standard_frame_ && !IsMaximized()) | 1032 if (remove_standard_frame_ && !IsMaximized()) |
1032 r.bottom += kClientAreaBottomInsetHack; | 1033 r.bottom += kClientAreaBottomInsetHack; |
1033 } else { | 1034 } else { |
1034 GetWindowRect(hwnd(), &r); | 1035 GetWindowRect(hwnd(), &r); |
1035 } | 1036 } |
1036 } | 1037 } |
1037 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 1038 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
1038 std::max(0, static_cast<int>(r.bottom - r.top))); | 1039 std::max(0, static_cast<int>(r.bottom - r.top))); |
1039 delegate_->HandleClientSizeChanged(s); | 1040 delegate_->HandleClientSizeChanged(s); |
1040 if (use_layered_buffer_) { | 1041 if (use_layered_buffer_) |
1041 layered_window_contents_.reset( | 1042 layered_window_contents_.reset(new gfx::Canvas(s, 1.0f, false)); |
1042 new gfx::Canvas(s, ui::SCALE_FACTOR_100P, false)); | |
1043 } | |
1044 } | 1043 } |
1045 | 1044 |
1046 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const { | 1045 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const { |
1047 if (delegate_->GetClientAreaInsets(insets)) | 1046 if (delegate_->GetClientAreaInsets(insets)) |
1048 return true; | 1047 return true; |
1049 DCHECK(insets->empty()); | 1048 DCHECK(insets->empty()); |
1050 | 1049 |
1051 // Returning false causes the default handling in OnNCCalcSize() to | 1050 // Returning false causes the default handling in OnNCCalcSize() to |
1052 // be invoked. | 1051 // be invoked. |
1053 if (!delegate_->IsWidgetWindow() || | 1052 if (!delegate_->IsWidgetWindow() || |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 delegate_->HandleVisibilityChanged(false); | 2207 delegate_->HandleVisibilityChanged(false); |
2209 SetMsgHandled(FALSE); | 2208 SetMsgHandled(FALSE); |
2210 } | 2209 } |
2211 | 2210 |
2212 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { | 2211 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { |
2213 for (size_t i = 0; i < touch_events.size(); ++i) | 2212 for (size_t i = 0; i < touch_events.size(); ++i) |
2214 delegate_->HandleTouchEvent(touch_events[i]); | 2213 delegate_->HandleTouchEvent(touch_events[i]); |
2215 } | 2214 } |
2216 | 2215 |
2217 } // namespace views | 2216 } // namespace views |
OLD | NEW |