Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: win8/metro_driver/chrome_app_view.cc

Issue 10983015: Metro side of the metro viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/chrome_app_view.cc
===================================================================
--- win8/metro_driver/chrome_app_view.cc (revision 158398)
+++ win8/metro_driver/chrome_app_view.cc (working copy)
@@ -13,11 +13,50 @@
#include "base/message_loop.h"
#include "base/win/metro.h"
+#include "base/threading/thread.h"
+#include "ipc/ipc_channel.h"
+#include "ipc/ipc_channel_proxy.h"
+#include "ipc/ipc_sender.h"
+
// This include allows to send WM_SYSCOMMANDs to chrome.
#include "chrome/app/chrome_command_ids.h"
#include "win8/metro_driver/winrt_utils.h"
#include "ui/base/ui_base_switches.h"
+//=============================================================================
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "win8/metro_driver/viewer_messages.h"
jam 2012/09/27 21:20:46 this is usually done in a separate cc file, i.e. v
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "win8/metro_driver/viewer_messages.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "win8/metro_driver/viewer_messages.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "win8/metro_driver/viewer_messages.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "win8/metro_driver/viewer_messages.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "win8/metro_driver/viewer_messages.h"
+} // namespace IPC
+
+//=============================================================================
+
typedef winfoundtn::ITypedEventHandler<
winapp::Core::CoreApplicationView*,
winapp::Activation::IActivatedEventArgs*> ActivatedHandler;
@@ -272,6 +311,26 @@
}
}
+class ChromeChannelListener : public IPC::Listener {
+ public:
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
+ DVLOG(1) << "Received ipc message " << message.type();
+ return true;
+ }
+
+ virtual void OnChannelError() OVERRIDE {
+ DVLOG(1) << "Channel error";
+ MessageLoop::current()->Quit();
+ }
+
+ void Init(IPC::Sender* s) {
+ sender_ = s;
+ }
+
+ private:
+ IPC::Sender* sender_;
+};
+
} // namespace
HRESULT ChromeAppView::TileRequestCreateDone(
@@ -788,6 +847,20 @@
DVLOG(1) << "Activate failed, hr=" << hr;
}
+ // The thread needs to out-live the ChannelProxy.
+ base::Thread thread("metro_IO_thread");
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_IO;
+ thread.StartWithOptions(options);
+
+ ChromeChannelListener channel_listener;
+ IPC::ChannelProxy chan("viewer", IPC::Channel::MODE_CLIENT,
+ &channel_listener, thread.message_loop_proxy());
+ channel_listener.Init(&chan);
+ chan.Send(new ViewerHostMsg_SetTargetSurface(uint32(globals.core_window)));
+
+ DVLOG(1) << "corewindow sent " << globals.core_window;
+
// Create a message loop to allow message passing into this thread.
MessageLoop msg_loop(MessageLoop::TYPE_UI);
@@ -902,6 +975,7 @@
DVLOG(1) << "CoreWindow found: " << std::hex << globals.core_window;
+#if 0
if (!globals.host_thread) {
DWORD chrome_ui_thread_id = 0;
globals.host_thread =
@@ -915,6 +989,7 @@
::AttachThreadInput(chrome_ui_thread_id, globals.main_thread_id, TRUE);
}
+#endif
if (RegisterHotKey(globals.core_window, kFlipWindowsHotKeyId,
MOD_CONTROL, VK_F12)) {
« no previous file with comments | « no previous file | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698