| 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 #include "chrome_frame/cfproxy_private.h" | 5 #include "chrome_frame/cfproxy_private.h" |
| 6 | 6 |
| 7 #include "base/tuple.h" | 7 #include "base/tuple.h" |
| 8 #include "ipc/ipc_sync_message.h" | 8 #include "ipc/ipc_sync_message.h" |
| 9 #include "chrome/common/automation_messages.h" | 9 #include "chrome/common/automation_messages.h" |
| 10 | 10 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 201 } |
| 202 | 202 |
| 203 void CFProxy::Tab_RunUnloadHandlers(int tab) { | 203 void CFProxy::Tab_RunUnloadHandlers(int tab) { |
| 204 IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(tab, 0); | 204 IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(tab, 0); |
| 205 ChromeProxyDelegate* p = Tab2Delegate(tab); | 205 ChromeProxyDelegate* p = Tab2Delegate(tab); |
| 206 sync_dispatcher_.QueueSyncMessage(m, p, NULL); | 206 sync_dispatcher_.QueueSyncMessage(m, p, NULL); |
| 207 SendIpcMessage(m); | 207 SendIpcMessage(m); |
| 208 } | 208 } |
| 209 | 209 |
| 210 // IPC::Channel::Listener | 210 // IPC::Channel::Listener |
| 211 void CFProxy::OnMessageReceived(const IPC::Message& message) { | 211 bool CFProxy::OnMessageReceived(const IPC::Message& message) { |
| 212 // Handle sync message reply. | 212 // Handle sync message reply. |
| 213 bool done = sync_dispatcher_.OnReplyReceived(&message); | 213 bool done = sync_dispatcher_.OnReplyReceived(&message); |
| 214 if (done) | 214 if (done) |
| 215 return; | 215 return true; |
| 216 | 216 |
| 217 // Handle tab related message. | 217 // Handle tab related message. |
| 218 ChromeProxyDelegate* d = Tab2Delegate(message.routing_id()); | 218 ChromeProxyDelegate* d = Tab2Delegate(message.routing_id()); |
| 219 if (d) | 219 if (d) |
| 220 return d->OnMessageReceived(message); | 220 return d->OnMessageReceived(message); |
| 221 | 221 |
| 222 DLOG(WARNING) << "Unknown message received!"; | 222 DLOG(WARNING) << "Unknown message received!"; |
| 223 return false; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void CFProxy::OnChannelConnected(int32 peer_pid) { | 226 void CFProxy::OnChannelConnected(int32 peer_pid) { |
| 226 is_connected_ = true; | 227 is_connected_ = true; |
| 227 // TODO(stoyan): May be we should wait for Hello message. | 228 // TODO(stoyan): May be we should wait for Hello message. |
| 228 for (DelegateList::iterator it = delegate_list_.begin(); | 229 for (DelegateList::iterator it = delegate_list_.begin(); |
| 229 it != delegate_list_.end(); ++it) { | 230 it != delegate_list_.end(); ++it) { |
| 230 (*it)->Connected(this); | 231 (*it)->Connected(this); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 void CFProxy::OnChannelError() { | 235 void CFProxy::OnChannelError() { |
| 235 is_connected_ = false; | 236 is_connected_ = false; |
| 236 | 237 |
| 237 // Inform the sync message callbacks that there are not going to see | 238 // Inform the sync message callbacks that there are not going to see |
| 238 // any reply. | 239 // any reply. |
| 239 sync_dispatcher_.OnChannelClosed(); | 240 sync_dispatcher_.OnChannelClosed(); |
| 240 OnPeerLost(ChromeProxyDelegate::CHANNEL_ERROR); | 241 OnPeerLost(ChromeProxyDelegate::CHANNEL_ERROR); |
| 241 | 242 |
| 242 // TODO(stoyan): Relaunch? | 243 // TODO(stoyan): Relaunch? |
| 243 } | 244 } |
| OLD | NEW |