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 "win8/metro_driver/stdafx.h" | 5 #include "win8/metro_driver/stdafx.h" |
6 #include "win8/metro_driver/chrome_app_view_ash.h" | 6 #include "win8/metro_driver/chrome_app_view_ash.h" |
7 | 7 |
8 #include <corewindow.h> | 8 #include <corewindow.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <stdint.h> |
10 #include <windows.foundation.h> | 11 #include <windows.foundation.h> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
16 #include "base/path_service.h" | 18 #include "base/path_service.h" |
17 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
18 #include "base/win/metro.h" | 20 #include "base/win/metro.h" |
19 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
20 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
21 #include "ipc/ipc_channel.h" | 23 #include "ipc/ipc_channel.h" |
22 #include "ipc/ipc_channel_proxy.h" | 24 #include "ipc/ipc_channel_proxy.h" |
23 #include "ipc/ipc_sender.h" | 25 #include "ipc/ipc_sender.h" |
24 #include "ui/events/gesture_detection/motion_event.h" | 26 #include "ui/events/gesture_detection/motion_event.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 TERMINATE_USING_KEY_SEQUENCE)); | 202 TERMINATE_USING_KEY_SEQUENCE)); |
201 } | 203 } |
202 | 204 |
203 void OnOpenURLOnDesktop(const base::FilePath& shortcut, | 205 void OnOpenURLOnDesktop(const base::FilePath& shortcut, |
204 const base::string16& url) { | 206 const base::string16& url) { |
205 ui_task_runner_->PostTask( | 207 ui_task_runner_->PostTask( |
206 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, | 208 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, |
207 base::Unretained(app_view_), shortcut, url)); | 209 base::Unretained(app_view_), shortcut, url)); |
208 } | 210 } |
209 | 211 |
210 void OnSetCursor(int64 cursor) { | 212 void OnSetCursor(int64_t cursor) { |
211 ui_task_runner_->PostTask( | 213 ui_task_runner_->PostTask( |
212 FROM_HERE, | 214 FROM_HERE, |
213 base::Bind(&ChromeAppViewAsh::OnSetCursor, base::Unretained(app_view_), | 215 base::Bind(&ChromeAppViewAsh::OnSetCursor, base::Unretained(app_view_), |
214 reinterpret_cast<HCURSOR>(cursor))); | 216 reinterpret_cast<HCURSOR>(cursor))); |
215 } | 217 } |
216 | 218 |
217 void OnDisplayFileOpenDialog(const base::string16& title, | 219 void OnDisplayFileOpenDialog(const base::string16& title, |
218 const base::string16& filter, | 220 const base::string16& filter, |
219 const base::FilePath& default_path, | 221 const base::FilePath& default_path, |
220 bool allow_multiple_files) { | 222 bool allow_multiple_files) { |
(...skipping 23 matching lines...) Expand all Loading... |
244 base::Unretained(app_view_), x, y)); | 246 base::Unretained(app_view_), x, y)); |
245 } | 247 } |
246 | 248 |
247 void OnImeCancelComposition() { | 249 void OnImeCancelComposition() { |
248 ui_task_runner_->PostTask( | 250 ui_task_runner_->PostTask( |
249 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeCancelComposition, | 251 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeCancelComposition, |
250 base::Unretained(app_view_))); | 252 base::Unretained(app_view_))); |
251 } | 253 } |
252 | 254 |
253 void OnImeTextInputClientChanged( | 255 void OnImeTextInputClientChanged( |
254 const std::vector<int32>& input_scopes, | 256 const std::vector<int32_t>& input_scopes, |
255 const std::vector<metro_viewer::CharacterBounds>& character_bounds) { | 257 const std::vector<metro_viewer::CharacterBounds>& character_bounds) { |
256 ui_task_runner_->PostTask( | 258 ui_task_runner_->PostTask( |
257 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeUpdateTextInputClient, | 259 FROM_HERE, base::Bind(&ChromeAppViewAsh::OnImeUpdateTextInputClient, |
258 base::Unretained(app_view_), input_scopes, | 260 base::Unretained(app_view_), input_scopes, |
259 character_bounds)); | 261 character_bounds)); |
260 } | 262 } |
261 | 263 |
262 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 264 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
263 ChromeAppViewAsh* app_view_; | 265 ChromeAppViewAsh* app_view_; |
264 }; | 266 }; |
(...skipping 10 matching lines...) Expand all Loading... |
275 // 3- Posting WM_CLOSE to the core window. | 277 // 3- Posting WM_CLOSE to the core window. |
276 dispatcher->ProcessEvents( | 278 dispatcher->ProcessEvents( |
277 winui::Core::CoreProcessEventsOption | 279 winui::Core::CoreProcessEventsOption |
278 ::CoreProcessEventsOption_ProcessUntilQuit); | 280 ::CoreProcessEventsOption_ProcessUntilQuit); |
279 | 281 |
280 // Wind down the thread's chrome message loop. | 282 // Wind down the thread's chrome message loop. |
281 base::MessageLoop::current()->QuitWhenIdle(); | 283 base::MessageLoop::current()->QuitWhenIdle(); |
282 } | 284 } |
283 | 285 |
284 // Helper to return the state of the shift/control/alt keys. | 286 // Helper to return the state of the shift/control/alt keys. |
285 uint32 GetKeyboardEventFlags() { | 287 uint32_t GetKeyboardEventFlags() { |
286 uint32 flags = 0; | 288 uint32_t flags = 0; |
287 if (ui::win::IsShiftPressed()) | 289 if (ui::win::IsShiftPressed()) |
288 flags |= ui::EF_SHIFT_DOWN; | 290 flags |= ui::EF_SHIFT_DOWN; |
289 if (ui::win::IsCtrlPressed()) | 291 if (ui::win::IsCtrlPressed()) |
290 flags |= ui::EF_CONTROL_DOWN; | 292 flags |= ui::EF_CONTROL_DOWN; |
291 if (ui::win::IsAltPressed()) | 293 if (ui::win::IsAltPressed()) |
292 flags |= ui::EF_ALT_DOWN; | 294 flags |= ui::EF_ALT_DOWN; |
293 return flags; | 295 return flags; |
294 } | 296 } |
295 | 297 |
296 bool LaunchChromeBrowserProcess(const wchar_t* additional_parameters, | 298 bool LaunchChromeBrowserProcess(const wchar_t* additional_parameters, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 435 } |
434 | 436 |
435 bool IsMouse() const { | 437 bool IsMouse() const { |
436 return IsType(windevs::Input::PointerDeviceType_Mouse); | 438 return IsType(windevs::Input::PointerDeviceType_Mouse); |
437 } | 439 } |
438 | 440 |
439 bool IsTouch() const { | 441 bool IsTouch() const { |
440 return IsType(windevs::Input::PointerDeviceType_Touch); | 442 return IsType(windevs::Input::PointerDeviceType_Touch); |
441 } | 443 } |
442 | 444 |
443 int32 wheel_delta() const { | 445 int32_t wheel_delta() const { return wheel_delta_; } |
444 return wheel_delta_; | |
445 } | |
446 | 446 |
447 // Identifies the button that changed. | 447 // Identifies the button that changed. |
448 ui::EventFlags changed_button() const { | 448 ui::EventFlags changed_button() const { |
449 switch (update_kind_) { | 449 switch (update_kind_) { |
450 case winui::Input::PointerUpdateKind_LeftButtonPressed: | 450 case winui::Input::PointerUpdateKind_LeftButtonPressed: |
451 return ui::EF_LEFT_MOUSE_BUTTON; | 451 return ui::EF_LEFT_MOUSE_BUTTON; |
452 case winui::Input::PointerUpdateKind_LeftButtonReleased: | 452 case winui::Input::PointerUpdateKind_LeftButtonReleased: |
453 return ui::EF_LEFT_MOUSE_BUTTON; | 453 return ui::EF_LEFT_MOUSE_BUTTON; |
454 case winui::Input::PointerUpdateKind_RightButtonPressed: | 454 case winui::Input::PointerUpdateKind_RightButtonPressed: |
455 return ui::EF_RIGHT_MOUSE_BUTTON; | 455 return ui::EF_RIGHT_MOUSE_BUTTON; |
456 case winui::Input::PointerUpdateKind_RightButtonReleased: | 456 case winui::Input::PointerUpdateKind_RightButtonReleased: |
457 return ui::EF_RIGHT_MOUSE_BUTTON; | 457 return ui::EF_RIGHT_MOUSE_BUTTON; |
458 case winui::Input::PointerUpdateKind_MiddleButtonPressed: | 458 case winui::Input::PointerUpdateKind_MiddleButtonPressed: |
459 return ui::EF_MIDDLE_MOUSE_BUTTON; | 459 return ui::EF_MIDDLE_MOUSE_BUTTON; |
460 case winui::Input::PointerUpdateKind_MiddleButtonReleased: | 460 case winui::Input::PointerUpdateKind_MiddleButtonReleased: |
461 return ui::EF_MIDDLE_MOUSE_BUTTON; | 461 return ui::EF_MIDDLE_MOUSE_BUTTON; |
462 default: | 462 default: |
463 return ui::EF_NONE; | 463 return ui::EF_NONE; |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 uint32 mouse_down_flags() const { return mouse_down_flags_; } | 467 uint32_t mouse_down_flags() const { return mouse_down_flags_; } |
468 | 468 |
469 int x() const { return x_; } | 469 int x() const { return x_; } |
470 int y() const { return y_; } | 470 int y() const { return y_; } |
471 | 471 |
472 uint32 pointer_id() const { | 472 uint32_t pointer_id() const { return pointer_id_; } |
473 return pointer_id_; | |
474 } | |
475 | 473 |
476 uint64 timestamp() const { return timestamp_; } | 474 uint64_t timestamp() const { return timestamp_; } |
477 | 475 |
478 winui::Input::PointerUpdateKind update_kind() const { return update_kind_; } | 476 winui::Input::PointerUpdateKind update_kind() const { return update_kind_; } |
479 | 477 |
480 bool is_horizontal_wheel() const { return !!is_horizontal_wheel_; } | 478 bool is_horizontal_wheel() const { return !!is_horizontal_wheel_; } |
481 | 479 |
482 private: | 480 private: |
483 int x_; | 481 int x_; |
484 int y_; | 482 int y_; |
485 int wheel_delta_; | 483 int wheel_delta_; |
486 uint32 pointer_id_; | 484 uint32_t pointer_id_; |
487 winui::Input::PointerUpdateKind update_kind_; | 485 winui::Input::PointerUpdateKind update_kind_; |
488 mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; | 486 mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; |
489 uint64 timestamp_; | 487 uint64_t timestamp_; |
490 | 488 |
491 // Bitmask of ui::EventFlags corresponding to the buttons that are currently | 489 // Bitmask of ui::EventFlags corresponding to the buttons that are currently |
492 // down. | 490 // down. |
493 uint32 mouse_down_flags_; | 491 uint32_t mouse_down_flags_; |
494 | 492 |
495 // Set to true for a horizontal wheel message. | 493 // Set to true for a horizontal wheel message. |
496 boolean is_horizontal_wheel_; | 494 boolean is_horizontal_wheel_; |
497 | 495 |
498 // The metro device scale factor as reported by the winrt interfaces. | 496 // The metro device scale factor as reported by the winrt interfaces. |
499 float metro_dpi_scale_; | 497 float metro_dpi_scale_; |
500 // The win32 dpi scale which is queried via GetDeviceCaps. Please refer to | 498 // The win32 dpi scale which is queried via GetDeviceCaps. Please refer to |
501 // ui/gfx/win/dpi.cc for more information. | 499 // ui/gfx/win/dpi.cc for more information. |
502 float win32_dpi_scale_; | 500 float win32_dpi_scale_; |
503 | 501 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 delete folder_picker; | 866 delete folder_picker; |
869 } | 867 } |
870 | 868 |
871 void ChromeAppViewAsh::OnImeCancelComposition() { | 869 void ChromeAppViewAsh::OnImeCancelComposition() { |
872 if (!text_service_) | 870 if (!text_service_) |
873 return; | 871 return; |
874 text_service_->CancelComposition(); | 872 text_service_->CancelComposition(); |
875 } | 873 } |
876 | 874 |
877 void ChromeAppViewAsh::OnImeUpdateTextInputClient( | 875 void ChromeAppViewAsh::OnImeUpdateTextInputClient( |
878 const std::vector<int32>& input_scopes, | 876 const std::vector<int32_t>& input_scopes, |
879 const std::vector<metro_viewer::CharacterBounds>& character_bounds) { | 877 const std::vector<metro_viewer::CharacterBounds>& character_bounds) { |
880 if (!text_service_) | 878 if (!text_service_) |
881 return; | 879 return; |
882 text_service_->OnDocumentChanged(input_scopes, character_bounds); | 880 text_service_->OnDocumentChanged(input_scopes, character_bounds); |
883 } | 881 } |
884 | 882 |
885 void ChromeAppViewAsh::OnImePopupChanged(ImePopupObserver::EventType event) { | 883 void ChromeAppViewAsh::OnImePopupChanged(ImePopupObserver::EventType event) { |
886 if (!ui_channel_) | 884 if (!ui_channel_) |
887 return; | 885 return; |
888 switch (event) { | 886 switch (event) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 if (!input_source_->GetActiveSource(&langid, &is_ime)) { | 938 if (!input_source_->GetActiveSource(&langid, &is_ime)) { |
941 LOG(ERROR) << "GetActiveSource failed"; | 939 LOG(ERROR) << "GetActiveSource failed"; |
942 return; | 940 return; |
943 } | 941 } |
944 ui_channel_->Send(new MetroViewerHostMsg_ImeInputSourceChanged(langid, | 942 ui_channel_->Send(new MetroViewerHostMsg_ImeInputSourceChanged(langid, |
945 is_ime)); | 943 is_ime)); |
946 } | 944 } |
947 | 945 |
948 void ChromeAppViewAsh::OnCompositionChanged( | 946 void ChromeAppViewAsh::OnCompositionChanged( |
949 const base::string16& text, | 947 const base::string16& text, |
950 int32 selection_start, | 948 int32_t selection_start, |
951 int32 selection_end, | 949 int32_t selection_end, |
952 const std::vector<metro_viewer::UnderlineInfo>& underlines) { | 950 const std::vector<metro_viewer::UnderlineInfo>& underlines) { |
953 ui_channel_->Send(new MetroViewerHostMsg_ImeCompositionChanged( | 951 ui_channel_->Send(new MetroViewerHostMsg_ImeCompositionChanged( |
954 text, selection_start, selection_end, underlines)); | 952 text, selection_start, selection_end, underlines)); |
955 } | 953 } |
956 | 954 |
957 void ChromeAppViewAsh::OnTextCommitted(const base::string16& text) { | 955 void ChromeAppViewAsh::OnTextCommitted(const base::string16& text) { |
958 ui_channel_->Send(new MetroViewerHostMsg_ImeTextCommitted(text)); | 956 ui_channel_->Send(new MetroViewerHostMsg_ImeTextCommitted(text)); |
959 } | 957 } |
960 | 958 |
961 void ChromeAppViewAsh::SendMouseButton(int x, | 959 void ChromeAppViewAsh::SendMouseButton(int x, |
962 int y, | 960 int y, |
963 int extra, | 961 int extra, |
964 ui::EventType event_type, | 962 ui::EventType event_type, |
965 uint32 flags, | 963 uint32_t flags, |
966 ui::EventFlags changed_button, | 964 ui::EventFlags changed_button, |
967 bool is_horizontal_wheel) { | 965 bool is_horizontal_wheel) { |
968 if (!ui_channel_) | 966 if (!ui_channel_) |
969 return; | 967 return; |
970 MetroViewerHostMsg_MouseButtonParams params; | 968 MetroViewerHostMsg_MouseButtonParams params; |
971 params.x = static_cast<int32>(x); | 969 params.x = static_cast<int32_t>(x); |
972 params.y = static_cast<int32>(y); | 970 params.y = static_cast<int32_t>(y); |
973 params.extra = static_cast<int32>(extra); | 971 params.extra = static_cast<int32_t>(extra); |
974 params.event_type = event_type; | 972 params.event_type = event_type; |
975 params.flags = static_cast<int32>(flags); | 973 params.flags = static_cast<int32_t>(flags); |
976 params.changed_button = changed_button; | 974 params.changed_button = changed_button; |
977 params.is_horizontal_wheel = is_horizontal_wheel; | 975 params.is_horizontal_wheel = is_horizontal_wheel; |
978 ui_channel_->Send(new MetroViewerHostMsg_MouseButton(params)); | 976 ui_channel_->Send(new MetroViewerHostMsg_MouseButton(params)); |
979 } | 977 } |
980 | 978 |
981 void ChromeAppViewAsh::GenerateMouseEventFromMoveIfNecessary( | 979 void ChromeAppViewAsh::GenerateMouseEventFromMoveIfNecessary( |
982 const PointerInfoHandler& pointer) { | 980 const PointerInfoHandler& pointer) { |
983 ui::EventType event_type; | 981 ui::EventType event_type; |
984 // For aura we want the flags to include the button that was released, thus | 982 // For aura we want the flags to include the button that was released, thus |
985 // we or the old and new. | 983 // we or the old and new. |
986 uint32 mouse_down_flags = pointer.mouse_down_flags() | mouse_down_flags_; | 984 uint32_t mouse_down_flags = pointer.mouse_down_flags() | mouse_down_flags_; |
987 mouse_down_flags_ = pointer.mouse_down_flags(); | 985 mouse_down_flags_ = pointer.mouse_down_flags(); |
988 switch (pointer.update_kind()) { | 986 switch (pointer.update_kind()) { |
989 case winui::Input::PointerUpdateKind_LeftButtonPressed: | 987 case winui::Input::PointerUpdateKind_LeftButtonPressed: |
990 case winui::Input::PointerUpdateKind_RightButtonPressed: | 988 case winui::Input::PointerUpdateKind_RightButtonPressed: |
991 case winui::Input::PointerUpdateKind_MiddleButtonPressed: | 989 case winui::Input::PointerUpdateKind_MiddleButtonPressed: |
992 event_type = ui::ET_MOUSE_PRESSED; | 990 event_type = ui::ET_MOUSE_PRESSED; |
993 break; | 991 break; |
994 case winui::Input::PointerUpdateKind_LeftButtonReleased: | 992 case winui::Input::PointerUpdateKind_LeftButtonReleased: |
995 case winui::Input::PointerUpdateKind_RightButtonReleased: | 993 case winui::Input::PointerUpdateKind_RightButtonReleased: |
996 case winui::Input::PointerUpdateKind_MiddleButtonReleased: | 994 case winui::Input::PointerUpdateKind_MiddleButtonReleased: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 return S_OK; | 1102 return S_OK; |
1105 | 1103 |
1106 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); | 1104 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
1107 HRESULT hr = pointer.Init(args); | 1105 HRESULT hr = pointer.Init(args); |
1108 if (FAILED(hr)) | 1106 if (FAILED(hr)) |
1109 return hr; | 1107 return hr; |
1110 | 1108 |
1111 if (pointer.IsMouse()) { | 1109 if (pointer.IsMouse()) { |
1112 mouse_down_flags_ = ui::EF_NONE; | 1110 mouse_down_flags_ = ui::EF_NONE; |
1113 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_RELEASED, | 1111 SendMouseButton(pointer.x(), pointer.y(), 0, ui::ET_MOUSE_RELEASED, |
1114 static_cast<uint32>(pointer.changed_button()) | | 1112 static_cast<uint32_t>(pointer.changed_button()) | |
1115 GetKeyboardEventFlags(), | 1113 GetKeyboardEventFlags(), |
1116 pointer.changed_button(), | 1114 pointer.changed_button(), pointer.is_horizontal_wheel()); |
1117 pointer.is_horizontal_wheel()); | |
1118 } else { | 1115 } else { |
1119 DCHECK(pointer.IsTouch()); | 1116 DCHECK(pointer.IsTouch()); |
1120 ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), | 1117 ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), |
1121 pointer.y(), | 1118 pointer.y(), |
1122 pointer.timestamp(), | 1119 pointer.timestamp(), |
1123 pointer.pointer_id())); | 1120 pointer.pointer_id())); |
1124 } | 1121 } |
1125 return S_OK; | 1122 return S_OK; |
1126 } | 1123 } |
1127 | 1124 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 winui::Core::CorePhysicalKeyStatus status; | 1196 winui::Core::CorePhysicalKeyStatus status; |
1200 hr = args->get_KeyStatus(&status); | 1197 hr = args->get_KeyStatus(&status); |
1201 if (FAILED(hr)) | 1198 if (FAILED(hr)) |
1202 return hr; | 1199 return hr; |
1203 | 1200 |
1204 winui::Core::CoreAcceleratorKeyEventType event_type; | 1201 winui::Core::CoreAcceleratorKeyEventType event_type; |
1205 hr = args->get_EventType(&event_type); | 1202 hr = args->get_EventType(&event_type); |
1206 if (FAILED(hr)) | 1203 if (FAILED(hr)) |
1207 return hr; | 1204 return hr; |
1208 | 1205 |
1209 uint32 keyboard_flags = GetKeyboardEventFlags(); | 1206 uint32_t keyboard_flags = GetKeyboardEventFlags(); |
1210 | 1207 |
1211 switch (event_type) { | 1208 switch (event_type) { |
1212 case winui::Core::CoreAcceleratorKeyEventType_SystemCharacter: | 1209 case winui::Core::CoreAcceleratorKeyEventType_SystemCharacter: |
1213 ui_channel_->Send(new MetroViewerHostMsg_Character(virtual_key, | 1210 ui_channel_->Send(new MetroViewerHostMsg_Character(virtual_key, |
1214 status.RepeatCount, | 1211 status.RepeatCount, |
1215 status.ScanCode, | 1212 status.ScanCode, |
1216 keyboard_flags)); | 1213 keyboard_flags)); |
1217 break; | 1214 break; |
1218 | 1215 |
1219 case winui::Core::CoreAcceleratorKeyEventType_SystemKeyDown: | 1216 case winui::Core::CoreAcceleratorKeyEventType_SystemKeyDown: |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 if (!window_ || !ui_channel_) { | 1370 if (!window_ || !ui_channel_) { |
1374 return S_OK; | 1371 return S_OK; |
1375 } | 1372 } |
1376 | 1373 |
1377 // winui::Core::IWindowSizeChangedEventArgs args->Size appears to return | 1374 // winui::Core::IWindowSizeChangedEventArgs args->Size appears to return |
1378 // scaled values under HiDPI. We will instead use GetWindowRect() which | 1375 // scaled values under HiDPI. We will instead use GetWindowRect() which |
1379 // should always return values in Pixels. | 1376 // should always return values in Pixels. |
1380 RECT rect = {0}; | 1377 RECT rect = {0}; |
1381 ::GetWindowRect(core_window_hwnd_, &rect); | 1378 ::GetWindowRect(core_window_hwnd_, &rect); |
1382 | 1379 |
1383 uint32 cx = static_cast<uint32>(rect.right - rect.left); | 1380 uint32_t cx = static_cast<uint32_t>(rect.right - rect.left); |
1384 uint32 cy = static_cast<uint32>(rect.bottom - rect.top); | 1381 uint32_t cy = static_cast<uint32_t>(rect.bottom - rect.top); |
1385 | 1382 |
1386 DVLOG(1) << "Window size changed: width=" << cx << ", height=" << cy; | 1383 DVLOG(1) << "Window size changed: width=" << cx << ", height=" << cy; |
1387 ui_channel_->Send(new MetroViewerHostMsg_WindowSizeChanged(cx, cy)); | 1384 ui_channel_->Send(new MetroViewerHostMsg_WindowSizeChanged(cx, cy)); |
1388 return S_OK; | 1385 return S_OK; |
1389 } | 1386 } |
1390 | 1387 |
1391 void ChromeAppViewAsh::StartChromeOSMode() { | 1388 void ChromeAppViewAsh::StartChromeOSMode() { |
1392 static int ms_elapsed = 0; | 1389 static int ms_elapsed = 0; |
1393 | 1390 |
1394 if (!IPC::Channel::IsNamedServerInitialized( | 1391 if (!IPC::Channel::IsNamedServerInitialized( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1456 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1460 CheckHR(core_app.As(&app_exit)); | 1457 CheckHR(core_app.As(&app_exit)); |
1461 globals.app_exit = app_exit.Detach(); | 1458 globals.app_exit = app_exit.Detach(); |
1462 } | 1459 } |
1463 | 1460 |
1464 IFACEMETHODIMP | 1461 IFACEMETHODIMP |
1465 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1462 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1466 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1463 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1467 return (*view) ? S_OK : E_OUTOFMEMORY; | 1464 return (*view) ? S_OK : E_OUTOFMEMORY; |
1468 } | 1465 } |
OLD | NEW |