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 <windows.foundation.h> | 10 #include <windows.foundation.h> |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 float win32_dpi_scale_; | 523 float win32_dpi_scale_; |
524 | 524 |
525 DISALLOW_COPY_AND_ASSIGN(PointerInfoHandler); | 525 DISALLOW_COPY_AND_ASSIGN(PointerInfoHandler); |
526 }; | 526 }; |
527 | 527 |
528 ChromeAppViewAsh::ChromeAppViewAsh() | 528 ChromeAppViewAsh::ChromeAppViewAsh() |
529 : mouse_down_flags_(ui::EF_NONE), | 529 : mouse_down_flags_(ui::EF_NONE), |
530 ui_channel_(nullptr), | 530 ui_channel_(nullptr), |
531 core_window_hwnd_(NULL), | 531 core_window_hwnd_(NULL), |
532 metro_dpi_scale_(0), | 532 metro_dpi_scale_(0), |
533 win32_dpi_scale_(0) { | 533 win32_dpi_scale_(0), |
| 534 last_cursor_(NULL) { |
534 DVLOG(1) << __FUNCTION__; | 535 DVLOG(1) << __FUNCTION__; |
535 globals.previous_state = | 536 globals.previous_state = |
536 winapp::Activation::ApplicationExecutionState_NotRunning; | 537 winapp::Activation::ApplicationExecutionState_NotRunning; |
537 } | 538 } |
538 | 539 |
539 ChromeAppViewAsh::~ChromeAppViewAsh() { | 540 ChromeAppViewAsh::~ChromeAppViewAsh() { |
540 DVLOG(1) << __FUNCTION__; | 541 DVLOG(1) << __FUNCTION__; |
541 } | 542 } |
542 | 543 |
543 IFACEMETHODIMP | 544 IFACEMETHODIMP |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 SHELLEXECUTEINFO sei = { sizeof(sei) }; | 809 SHELLEXECUTEINFO sei = { sizeof(sei) }; |
809 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 810 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
810 sei.nShow = SW_SHOWNORMAL; | 811 sei.nShow = SW_SHOWNORMAL; |
811 sei.lpFile = file.c_str(); | 812 sei.lpFile = file.c_str(); |
812 sei.lpDirectory = L""; | 813 sei.lpDirectory = L""; |
813 sei.lpParameters = url.c_str(); | 814 sei.lpParameters = url.c_str(); |
814 BOOL result = ShellExecuteEx(&sei); | 815 BOOL result = ShellExecuteEx(&sei); |
815 } | 816 } |
816 | 817 |
817 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { | 818 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { |
818 ::SetCursor(HCURSOR(cursor)); | 819 ::SetCursor(cursor); |
| 820 last_cursor_ = cursor; |
819 } | 821 } |
820 | 822 |
821 void ChromeAppViewAsh::OnDisplayFileOpenDialog( | 823 void ChromeAppViewAsh::OnDisplayFileOpenDialog( |
822 const base::string16& title, | 824 const base::string16& title, |
823 const base::string16& filter, | 825 const base::string16& filter, |
824 const base::FilePath& default_path, | 826 const base::FilePath& default_path, |
825 bool allow_multiple_files) { | 827 bool allow_multiple_files) { |
826 DVLOG(1) << __FUNCTION__; | 828 DVLOG(1) << __FUNCTION__; |
827 | 829 |
828 // The OpenFilePickerSession instance is deleted when we receive a | 830 // The OpenFilePickerSession instance is deleted when we receive a |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 } | 1077 } |
1076 | 1078 |
1077 HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, | 1079 HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, |
1078 winui::Core::IPointerEventArgs* args) { | 1080 winui::Core::IPointerEventArgs* args) { |
1079 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); | 1081 PointerInfoHandler pointer(metro_dpi_scale_, win32_dpi_scale_); |
1080 HRESULT hr = pointer.Init(args); | 1082 HRESULT hr = pointer.Init(args); |
1081 if (FAILED(hr)) | 1083 if (FAILED(hr)) |
1082 return hr; | 1084 return hr; |
1083 | 1085 |
1084 if (pointer.IsMouse()) { | 1086 if (pointer.IsMouse()) { |
| 1087 // If the mouse was moved towards the charms or the OS specific section, |
| 1088 // the cursor may change from what the browser last set. Restore it here. |
| 1089 if (::GetCursor() != last_cursor_) |
| 1090 SetCursor(last_cursor_); |
| 1091 |
1085 GenerateMouseEventFromMoveIfNecessary(pointer); | 1092 GenerateMouseEventFromMoveIfNecessary(pointer); |
1086 ui_channel_->Send(new MetroViewerHostMsg_MouseMoved( | 1093 ui_channel_->Send(new MetroViewerHostMsg_MouseMoved( |
1087 pointer.x(), | 1094 pointer.x(), |
1088 pointer.y(), | 1095 pointer.y(), |
1089 mouse_down_flags_ | GetKeyboardEventFlags())); | 1096 mouse_down_flags_ | GetKeyboardEventFlags())); |
1090 } else { | 1097 } else { |
1091 DCHECK(pointer.IsTouch()); | 1098 DCHECK(pointer.IsTouch()); |
1092 ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), | 1099 ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), |
1093 pointer.y(), | 1100 pointer.y(), |
1094 pointer.timestamp(), | 1101 pointer.timestamp(), |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1403 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1397 CheckHR(core_app.As(&app_exit)); | 1404 CheckHR(core_app.As(&app_exit)); |
1398 globals.app_exit = app_exit.Detach(); | 1405 globals.app_exit = app_exit.Detach(); |
1399 } | 1406 } |
1400 | 1407 |
1401 IFACEMETHODIMP | 1408 IFACEMETHODIMP |
1402 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1409 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1403 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1410 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1404 return (*view) ? S_OK : E_OUTOFMEMORY; | 1411 return (*view) ? S_OK : E_OUTOFMEMORY; |
1405 } | 1412 } |
OLD | NEW |