| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ | 5 #ifndef CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ |
| 6 #define CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ | 6 #define CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/process_util.h" |
| 11 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 12 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
| 13 #include "ipc/ipc_sender.h" | 14 #include "ipc/ipc_sender.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 | 16 |
| 16 namespace IPC { | 17 namespace IPC { |
| 17 class ChannelProxy; | 18 class ChannelProxy; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class MetroViewerProcessHost : public IPC::Listener, | 21 class MetroViewerProcessHost : public IPC::Listener, |
| 21 public IPC::Sender, | 22 public IPC::Sender, |
| 22 public base::NonThreadSafe { | 23 public base::NonThreadSafe { |
| 23 public: | 24 public: |
| 24 explicit MetroViewerProcessHost(const std::string& ipc_channel_name); | 25 explicit MetroViewerProcessHost(const std::string& ipc_channel_name); |
| 25 virtual ~MetroViewerProcessHost(); | 26 virtual ~MetroViewerProcessHost(); |
| 26 | 27 |
| 28 // Returns the process id of the viewer process if one is connected to this |
| 29 // host, returns base::kNullProcessId otherwise. |
| 30 base::ProcessId GetViewerProcessId(); |
| 31 |
| 27 private: | 32 private: |
| 28 // IPC::Sender implementation: | 33 // IPC::Sender implementation: |
| 29 virtual bool Send(IPC::Message* msg) OVERRIDE; | 34 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 30 | 35 |
| 31 // IPC::Listener implementation: | 36 // IPC::Listener implementation: |
| 32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 33 virtual void OnChannelError() OVERRIDE; | 38 virtual void OnChannelError() OVERRIDE; |
| 34 | 39 |
| 35 void OnSetTargetSurface(gfx::NativeViewId target_surface); | 40 void OnSetTargetSurface(gfx::NativeViewId target_surface); |
| 36 | 41 |
| 37 scoped_ptr<IPC::ChannelProxy> channel_; | 42 scoped_ptr<IPC::ChannelProxy> channel_; |
| 38 | 43 |
| 39 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); | 44 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); |
| 40 }; | 45 }; |
| 41 | 46 |
| 42 #endif // CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ | 47 #endif // CHROME_BROWSER_METRO_VIEWER_METRO_VIEWER_PROCESS_HOST_WIN_H_ |
| OLD | NEW |