| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 5 #ifndef WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
| 6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_channel_proxy.h" |
| 13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
| 14 #include "ipc/ipc_message_listener.h" |
| 14 #include "ipc/ipc_sender.h" | 15 #include "ipc/ipc_sender.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
| 19 class WaitableEvent; | 20 class WaitableEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace IPC { | 23 namespace IPC { |
| 24 class ChannelProxy; |
| 23 class Message; | 25 class Message; |
| 24 } | 26 } |
| 25 | 27 |
| 26 namespace win8 { | 28 namespace win8 { |
| 27 | 29 |
| 28 // Abstract base class for various Metro viewer process host implementations. | 30 // Abstract base class for various Metro viewer process host implementations. |
| 29 class MetroViewerProcessHost : public IPC::Listener, | 31 class MetroViewerProcessHost : public IPC::Listener, |
| 30 public IPC::Sender, | 32 public IPC::Sender, |
| 31 public base::NonThreadSafe { | 33 public base::NonThreadSafe { |
| 32 public: | 34 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 77 |
| 76 // Called over IPC by the viewer process when the window size has changed. | 78 // Called over IPC by the viewer process when the window size has changed. |
| 77 virtual void OnWindowSizeChanged(uint32 width, uint32 height) = 0; | 79 virtual void OnWindowSizeChanged(uint32 width, uint32 height) = 0; |
| 78 | 80 |
| 79 void NotifyChannelConnected(); | 81 void NotifyChannelConnected(); |
| 80 | 82 |
| 81 // Inner message filter used to handle connection event on the IPC channel | 83 // Inner message filter used to handle connection event on the IPC channel |
| 82 // proxy's background thread. This prevents consumers of | 84 // proxy's background thread. This prevents consumers of |
| 83 // MetroViewerProcessHost from having to pump messages on their own message | 85 // MetroViewerProcessHost from having to pump messages on their own message |
| 84 // loop. | 86 // loop. |
| 85 class InternalMessageFilter : public IPC::ChannelProxy::MessageFilter { | 87 class InternalMessageFilter : public IPC::MessageFilter { |
| 86 public: | 88 public: |
| 87 InternalMessageFilter(MetroViewerProcessHost* owner); | 89 InternalMessageFilter(MetroViewerProcessHost* owner); |
| 88 | 90 |
| 89 // IPC::ChannelProxy::MessageFilter implementation. | 91 // IPC::MessageFilter implementation. |
| 90 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 92 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 91 | 93 |
| 92 private: | 94 private: |
| 93 MetroViewerProcessHost* owner_; | 95 MetroViewerProcessHost* owner_; |
| 94 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); | 96 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 scoped_ptr<IPC::ChannelProxy> channel_; | 99 scoped_ptr<IPC::ChannelProxy> channel_; |
| 98 scoped_ptr<base::WaitableEvent> channel_connected_event_; | 100 scoped_ptr<base::WaitableEvent> channel_connected_event_; |
| 99 scoped_refptr<InternalMessageFilter> message_filter_; | 101 scoped_refptr<InternalMessageFilter> message_filter_; |
| 100 | 102 |
| 101 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); | 103 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 } // namespace win8 | 106 } // namespace win8 |
| 105 | 107 |
| 106 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 108 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
| OLD | NEW |