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.h" | 6 #include "win8/metro_driver/chrome_app_view.h" |
7 #include "win8/metro_driver/direct3d_helper.h" | 7 #include "win8/metro_driver/direct3d_helper.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <windows.applicationModel.datatransfer.h> | 10 #include <windows.applicationModel.datatransfer.h> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Ajust the frame so the live preview works and the frame buttons dissapear. | 213 // Ajust the frame so the live preview works and the frame buttons dissapear. |
214 ::SetWindowLong(hwnd, GWL_STYLE, | 214 ::SetWindowLong(hwnd, GWL_STYLE, |
215 WS_POPUP | (::GetWindowLong(hwnd, GWL_STYLE) & | 215 WS_POPUP | (::GetWindowLong(hwnd, GWL_STYLE) & |
216 ~(WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU))); | 216 ~(WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU))); |
217 ::SetWindowLong(hwnd, GWL_EXSTYLE, | 217 ::SetWindowLong(hwnd, GWL_EXSTYLE, |
218 ::GetWindowLong(hwnd, GWL_EXSTYLE) & ~(WS_EX_DLGMODALFRAME | | 218 ::GetWindowLong(hwnd, GWL_EXSTYLE) & ~(WS_EX_DLGMODALFRAME | |
219 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); | 219 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); |
220 | 220 |
221 // Subclass the wndproc of the frame window, if it's not already there. | 221 // Subclass the wndproc of the frame window, if it's not already there. |
222 if (::GetProp(hwnd, kChromeSubclassWindowProp) == NULL) { | 222 if (::GetProp(hwnd, kChromeSubclassWindowProp) == NULL) { |
223 WNDPROC old_chrome_proc = reinterpret_cast<WNDPROC>( | 223 WNDPROC old_chrome_proc = |
224 ::SetWindowLong(hwnd, GWL_WNDPROC, | 224 reinterpret_cast<WNDPROC>(::SetWindowLongPtr( |
225 reinterpret_cast<long>(ChromeWindowProc))); | 225 hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(ChromeWindowProc))); |
226 ::SetProp(hwnd, kChromeSubclassWindowProp, old_chrome_proc); | 226 ::SetProp(hwnd, kChromeSubclassWindowProp, old_chrome_proc); |
227 } | 227 } |
228 AdjustToFitWindow(hwnd, SWP_FRAMECHANGED | SWP_NOACTIVATE); | 228 AdjustToFitWindow(hwnd, SWP_FRAMECHANGED | SWP_NOACTIVATE); |
229 } | 229 } |
230 | 230 |
231 void SetFrameWindowInternal(HWND hwnd) { | 231 void SetFrameWindowInternal(HWND hwnd) { |
232 DVLOG(1) << __FUNCTION__ << ", hwnd=" << LONG_PTR(hwnd); | 232 DVLOG(1) << __FUNCTION__ << ", hwnd=" << LONG_PTR(hwnd); |
233 | 233 |
234 HWND current_top_frame = | 234 HWND current_top_frame = |
235 !globals.host_windows.empty() ? globals.host_windows.front().first : NULL; | 235 !globals.host_windows.empty() ? globals.host_windows.front().first : NULL; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 630 |
631 DWORD WINAPI HostMainThreadProc(void*) { | 631 DWORD WINAPI HostMainThreadProc(void*) { |
632 // Test feature - devs have requested the ability to easily add metro-chrome | 632 // Test feature - devs have requested the ability to easily add metro-chrome |
633 // command line arguments. This is hard since shortcut arguments are ignored, | 633 // command line arguments. This is hard since shortcut arguments are ignored, |
634 // by Metro, so we instead read them directly from the pinned taskbar | 634 // by Metro, so we instead read them directly from the pinned taskbar |
635 // shortcut. This may call Coinitialize and there is tell of badness | 635 // shortcut. This may call Coinitialize and there is tell of badness |
636 // occurring if CoInitialize is called on a metro thread. | 636 // occurring if CoInitialize is called on a metro thread. |
637 globals.metro_command_line_switches = | 637 globals.metro_command_line_switches = |
638 winrt_utils::ReadArgumentsFromPinnedTaskbarShortcut(); | 638 winrt_utils::ReadArgumentsFromPinnedTaskbarShortcut(); |
639 | 639 |
640 globals.g_core_proc = reinterpret_cast<WNDPROC>( | 640 globals.g_core_proc = |
641 ::SetWindowLong(globals.core_window, GWL_WNDPROC, | 641 reinterpret_cast<WNDPROC>(::SetWindowLongPtr( |
642 reinterpret_cast<long>(ChromeAppView::CoreWindowProc))); | 642 globals.core_window, GWLP_WNDPROC, |
| 643 reinterpret_cast<LONG_PTR>(ChromeAppView::CoreWindowProc))); |
643 DWORD exit_code = globals.host_main(globals.host_context); | 644 DWORD exit_code = globals.host_main(globals.host_context); |
644 | 645 |
645 DVLOG(1) << "host thread done, exit_code=" << exit_code; | 646 DVLOG(1) << "host thread done, exit_code=" << exit_code; |
646 MetroExit(true); | 647 MetroExit(true); |
647 return exit_code; | 648 return exit_code; |
648 } | 649 } |
649 | 650 |
650 ChromeAppView::ChromeAppView() | 651 ChromeAppView::ChromeAppView() |
651 : osk_visible_notification_received_(false), | 652 : osk_visible_notification_received_(false), |
652 osk_offset_adjustment_(0) { | 653 osk_offset_adjustment_(0) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 CheckHR(core_app.As(&app_exit)); | 1207 CheckHR(core_app.As(&app_exit)); |
1207 globals.app_exit = app_exit.Detach(); | 1208 globals.app_exit = app_exit.Detach(); |
1208 } | 1209 } |
1209 | 1210 |
1210 IFACEMETHODIMP | 1211 IFACEMETHODIMP |
1211 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1212 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1212 globals.view = mswr::Make<ChromeAppView>().Detach(); | 1213 globals.view = mswr::Make<ChromeAppView>().Detach(); |
1213 *view = globals.view; | 1214 *view = globals.view; |
1214 return (*view) ? S_OK : E_OUTOFMEMORY; | 1215 return (*view) ? S_OK : E_OUTOFMEMORY; |
1215 } | 1216 } |
OLD | NEW |