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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void RunMessageLoop(winui::Core::ICoreDispatcher* dispatcher) { | 277 void RunMessageLoop(winui::Core::ICoreDispatcher* dispatcher) { |
278 // We're entering a nested message loop, let's allow dispatching | 278 // We're entering a nested message loop, let's allow dispatching |
279 // tasks while we're in there. | 279 // tasks while we're in there. |
280 base::MessageLoop::current()->SetNestableTasksAllowed(true); | 280 base::MessageLoop::current()->SetNestableTasksAllowed(true); |
281 | 281 |
282 // Enter main core message loop. There are several ways to exit it | 282 // Enter main core message loop. There are several ways to exit it |
283 // Nicely: | 283 // Nicely: |
284 // 1 - User action like ALT-F4. | 284 // 1 - User action like ALT-F4. |
285 // 2 - Calling ICoreApplicationExit::Exit(). | 285 // 2 - Calling ICoreApplicationExit::Exit(). |
286 // 3- Posting WM_CLOSE to the core window. | 286 // 3- Posting WM_CLOSE to the core window. |
287 HRESULT hr = dispatcher->ProcessEvents( | 287 dispatcher->ProcessEvents( |
288 winui::Core::CoreProcessEventsOption | 288 winui::Core::CoreProcessEventsOption |
289 ::CoreProcessEventsOption_ProcessUntilQuit); | 289 ::CoreProcessEventsOption_ProcessUntilQuit); |
290 | 290 |
291 // Wind down the thread's chrome message loop. | 291 // Wind down the thread's chrome message loop. |
292 base::MessageLoop::current()->Quit(); | 292 base::MessageLoop::current()->Quit(); |
293 } | 293 } |
294 | 294 |
295 // Helper to return the state of the shift/control/alt keys. | 295 // Helper to return the state of the shift/control/alt keys. |
296 uint32 GetKeyboardEventFlags() { | 296 uint32 GetKeyboardEventFlags() { |
297 uint32 flags = 0; | 297 uint32 flags = 0; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 768 |
769 void ChromeAppViewAsh::OnOpenURLOnDesktop(const base::FilePath& shortcut, | 769 void ChromeAppViewAsh::OnOpenURLOnDesktop(const base::FilePath& shortcut, |
770 const base::string16& url) { | 770 const base::string16& url) { |
771 base::FilePath::StringType file = shortcut.value(); | 771 base::FilePath::StringType file = shortcut.value(); |
772 SHELLEXECUTEINFO sei = { sizeof(sei) }; | 772 SHELLEXECUTEINFO sei = { sizeof(sei) }; |
773 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 773 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
774 sei.nShow = SW_SHOWNORMAL; | 774 sei.nShow = SW_SHOWNORMAL; |
775 sei.lpFile = file.c_str(); | 775 sei.lpFile = file.c_str(); |
776 sei.lpDirectory = L""; | 776 sei.lpDirectory = L""; |
777 sei.lpParameters = url.c_str(); | 777 sei.lpParameters = url.c_str(); |
778 BOOL result = ShellExecuteEx(&sei); | 778 ShellExecuteEx(&sei); |
779 } | 779 } |
780 | 780 |
781 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { | 781 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { |
782 ::SetCursor(cursor); | 782 ::SetCursor(cursor); |
783 last_cursor_ = cursor; | 783 last_cursor_ = cursor; |
784 } | 784 } |
785 | 785 |
786 void ChromeAppViewAsh::OnDisplayFileOpenDialog( | 786 void ChromeAppViewAsh::OnDisplayFileOpenDialog( |
787 const base::string16& title, | 787 const base::string16& title, |
788 const base::string16& filter, | 788 const base::string16& filter, |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1471 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1472 CheckHR(core_app.As(&app_exit)); | 1472 CheckHR(core_app.As(&app_exit)); |
1473 globals.app_exit = app_exit.Detach(); | 1473 globals.app_exit = app_exit.Detach(); |
1474 } | 1474 } |
1475 | 1475 |
1476 IFACEMETHODIMP | 1476 IFACEMETHODIMP |
1477 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1477 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1478 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1478 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1479 return (*view) ? S_OK : E_OUTOFMEMORY; | 1479 return (*view) ? S_OK : E_OUTOFMEMORY; |
1480 } | 1480 } |
OLD | NEW |