Chromium Code Reviews| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 void FlipFrameWindows() { | 512 void FlipFrameWindows() { |
| 513 DVLOG(1) << __FUNCTION__; | 513 DVLOG(1) << __FUNCTION__; |
| 514 globals.appview_msg_loop->PostTask( | 514 globals.appview_msg_loop->PostTask( |
| 515 FROM_HERE, base::Bind(&FlipFrameWindowsInternal)); | 515 FROM_HERE, base::Bind(&FlipFrameWindowsInternal)); |
| 516 } | 516 } |
| 517 | 517 |
| 518 extern "C" __declspec(dllexport) | 518 extern "C" __declspec(dllexport) |
| 519 void DisplayNotification(const char* origin_url, const char* icon_url, | 519 void DisplayNotification(const char* origin_url, const char* icon_url, |
| 520 const wchar_t* title, const wchar_t* body, | 520 const wchar_t* title, const wchar_t* body, |
| 521 const wchar_t* display_source, | 521 const wchar_t* display_source, |
| 522 const char* notification_id) { | 522 const char* notification_id, |
| 523 base::win::MetroNotificationClickedHandler handler, | |
| 524 const wchar_t* handler_context) { | |
| 523 // TODO(ananta) | 525 // TODO(ananta) |
| 524 // Needs implementation. | 526 // Needs implementation. |
| 525 DVLOG(1) << __FUNCTION__; | 527 DVLOG(1) << __FUNCTION__; |
| 526 | 528 |
| 527 ToastNotificationHandler::DesktopNotification notification(origin_url, | 529 ToastNotificationHandler::DesktopNotification notification(origin_url, |
| 528 icon_url, | 530 icon_url, |
| 529 title, | 531 title, |
| 530 body, | 532 body, |
| 531 display_source, | 533 display_source, |
| 532 notification_id); | 534 notification_id, |
| 535 handler, | |
| 536 handler_context); | |
| 533 globals.appview_msg_loop->PostTask( | 537 globals.appview_msg_loop->PostTask( |
| 534 FROM_HERE, base::Bind(&ChromeAppView::DisplayNotification, | 538 FROM_HERE, base::Bind(&ChromeAppView::DisplayNotification, |
| 535 globals.view, notification)); | 539 globals.view, notification)); |
| 536 } | 540 } |
| 537 | 541 |
| 538 extern "C" __declspec(dllexport) | 542 extern "C" __declspec(dllexport) |
| 539 bool CancelNotification(const char* notification_id) { | 543 bool CancelNotification(const char* notification_id) { |
| 540 // TODO(ananta) | 544 // TODO(ananta) |
| 541 // Needs implementation. | 545 // Needs implementation. |
| 542 DVLOG(1) << __FUNCTION__; | 546 DVLOG(1) << __FUNCTION__; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 | 840 |
| 837 // Announce our message loop to the world. | 841 // Announce our message loop to the world. |
| 838 globals.appview_msg_loop = msg_loop.message_loop_proxy(); | 842 globals.appview_msg_loop = msg_loop.message_loop_proxy(); |
| 839 | 843 |
| 840 // The thread needs to out-live the ChannelProxy. | 844 // The thread needs to out-live the ChannelProxy. |
| 841 base::Thread thread("metro_IO_thread"); | 845 base::Thread thread("metro_IO_thread"); |
| 842 base::Thread::Options options; | 846 base::Thread::Options options; |
| 843 options.message_loop_type = MessageLoop::TYPE_IO; | 847 options.message_loop_type = MessageLoop::TYPE_IO; |
| 844 thread.StartWithOptions(options); | 848 thread.StartWithOptions(options); |
| 845 | 849 |
| 850 #if defined(USE_AURA) | |
|
robertshield
2012/10/09 21:17:14
Why is this #if here?
ananta
2012/10/09 21:20:53
This code is specific to AURA. Will remove it if y
robertshield
2012/10/09 21:44:57
It's ok to leave it, but please add a brief commen
ananta
2012/10/09 21:58:34
Done.
| |
| 846 ChromeChannelListener channel_listener; | 851 ChromeChannelListener channel_listener; |
| 847 IPC::ChannelProxy chan("viewer", IPC::Channel::MODE_NAMED_CLIENT, | 852 IPC::ChannelProxy chan("viewer", IPC::Channel::MODE_NAMED_CLIENT, |
| 848 &channel_listener, thread.message_loop_proxy()); | 853 &channel_listener, thread.message_loop_proxy()); |
| 849 channel_listener.Init(&chan); | 854 channel_listener.Init(&chan); |
| 850 chan.Send(new MetroViewerHostMsg_SetTargetSurface( | 855 chan.Send(new MetroViewerHostMsg_SetTargetSurface( |
| 851 gfx::NativeViewId(globals.core_window))); | 856 gfx::NativeViewId(globals.core_window))); |
| 852 | 857 |
| 853 DVLOG(1) << "ICoreWindow sent " << globals.core_window; | 858 DVLOG(1) << "ICoreWindow sent " << globals.core_window; |
| 854 | 859 #endif |
| 855 // And post the task that'll do the inner Metro message pumping to it. | 860 // And post the task that'll do the inner Metro message pumping to it. |
| 856 msg_loop.PostTask(FROM_HERE, base::Bind(&RunMessageLoop, dispatcher.Get())); | 861 msg_loop.PostTask(FROM_HERE, base::Bind(&RunMessageLoop, dispatcher.Get())); |
| 857 | 862 |
| 858 // Post the recurring task which checks for OSK activation in metro chrome. | 863 // Post the recurring task which checks for OSK activation in metro chrome. |
| 859 // Please refer to the comments in the CheckForOSKActivation function for why | 864 // Please refer to the comments in the CheckForOSKActivation function for why |
| 860 // this is needed. | 865 // this is needed. |
| 861 // TODO(ananta) | 866 // TODO(ananta) |
| 862 // Take this out when the documented OSK notifications start working. | 867 // Take this out when the documented OSK notifications start working. |
| 863 msg_loop.PostDelayedTask( | 868 msg_loop.PostDelayedTask( |
| 864 FROM_HERE, | 869 FROM_HERE, |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1245 CheckHR(core_app.As(&app_exit)); | 1250 CheckHR(core_app.As(&app_exit)); |
| 1246 globals.app_exit = app_exit.Detach(); | 1251 globals.app_exit = app_exit.Detach(); |
| 1247 } | 1252 } |
| 1248 | 1253 |
| 1249 IFACEMETHODIMP | 1254 IFACEMETHODIMP |
| 1250 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1255 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
| 1251 globals.view = mswr::Make<ChromeAppView>().Detach(); | 1256 globals.view = mswr::Make<ChromeAppView>().Detach(); |
| 1252 *view = globals.view; | 1257 *view = globals.view; |
| 1253 return (*view) ? S_OK : E_OUTOFMEMORY; | 1258 return (*view) ? S_OK : E_OUTOFMEMORY; |
| 1254 } | 1259 } |
| OLD | NEW |