OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_FRAME_CFPROXY_H_ | 5 #ifndef CHROME_FRAME_CFPROXY_H_ |
6 #define CHROME_FRAME_CFPROXY_H_ | 6 #define CHROME_FRAME_CFPROXY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <map> // for proxy factory | 10 #include <map> // for proxy factory |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Allow only one delegate per tab, i.e. delegate can handle only a single tab. | 141 // Allow only one delegate per tab, i.e. delegate can handle only a single tab. |
142 // Note: all of the methods are invoked always in a background IPC thread. | 142 // Note: all of the methods are invoked always in a background IPC thread. |
143 class ChromeProxyDelegate : public IPC::Channel::Listener { | 143 class ChromeProxyDelegate : public IPC::Channel::Listener { |
144 public: | 144 public: |
145 enum DisconnectReason { | 145 enum DisconnectReason { |
146 CHROME_EXE_LAUNCH_FAILED, | 146 CHROME_EXE_LAUNCH_FAILED, |
147 CHROME_EXE_LAUNCH_TIMEOUT, | 147 CHROME_EXE_LAUNCH_TIMEOUT, |
148 CHANNEL_ERROR | 148 CHANNEL_ERROR |
149 }; | 149 }; |
150 | 150 |
151 // IPC::Channel::Listener. | |
152 void OnMessageReceived(const IPC::Message& message) = 0; | |
153 | |
154 virtual void Connected(ChromeProxy* proxy) = 0; | 151 virtual void Connected(ChromeProxy* proxy) = 0; |
155 virtual void Disconnected() = 0; | 152 virtual void Disconnected() = 0; |
156 virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; | 153 virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; |
157 virtual int tab_handle() = 0; // to avoid reverse lookup :) | 154 virtual int tab_handle() = 0; // to avoid reverse lookup :) |
158 | 155 |
159 // Sync message responses. | 156 // Sync message responses. |
160 virtual void Completed_CreateTab(bool success, HWND chrome_wnd, | 157 virtual void Completed_CreateTab(bool success, HWND chrome_wnd, |
161 HWND tab_window, int tab_handle, int session_id) = 0; | 158 HWND tab_window, int tab_handle, int session_id) = 0; |
162 virtual void Completed_ConnectToTab(bool success, HWND chrome_window, | 159 virtual void Completed_ConnectToTab(bool success, HWND chrome_window, |
163 HWND tab_window, int tab_handle, int session_id) = 0; | 160 HWND tab_window, int tab_handle, int session_id) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
189 void GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params); | 186 void GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params); |
190 bool ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile); | 187 bool ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile); |
191 protected: | 188 protected: |
192 virtual ChromeProxy* CreateProxy(); | 189 virtual ChromeProxy* CreateProxy(); |
193 typedef std::map<std::string, ChromeProxy*> ProxyMap; | 190 typedef std::map<std::string, ChromeProxy*> ProxyMap; |
194 ProxyMap proxies_; | 191 ProxyMap proxies_; |
195 Lock lock_; | 192 Lock lock_; |
196 }; | 193 }; |
197 | 194 |
198 #endif // CHROME_FRAME_CFPROXY_H_ | 195 #endif // CHROME_FRAME_CFPROXY_H_ |
OLD | NEW |