OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 DelegateHolder::RemoveDelegate(delegate); | 57 DelegateHolder::RemoveDelegate(delegate); |
58 delegate->Disconnected(); | 58 delegate->Disconnected(); |
59 } | 59 } |
60 | 60 |
61 void CFProxy::InitInIoThread(const ProxyParams& params) { | 61 void CFProxy::InitInIoThread(const ProxyParams& params) { |
62 DCHECK(CalledOnIpcThread()); | 62 DCHECK(CalledOnIpcThread()); |
63 std::string channel_id = GenerateChannelId(); | 63 std::string channel_id = GenerateChannelId(); |
64 ipc_sender_ = api_->CreateChannel(channel_id, this); | 64 ipc_sender_ = api_->CreateChannel(channel_id, this); |
65 std::wstring cmd_line = BuildCmdLine(channel_id, params.profile_path, | 65 std::wstring cmd_line = BuildCmdLine(channel_id, params.profile_path, |
66 params.extra_params); | 66 params.extra_params); |
67 if (api_->LaunchApp(cmd_line)) { | 67 if (!cmd_line.empty() && api_->LaunchApp(cmd_line)) { |
68 CancelableTask* launch_timeout = NewRunnableMethod(this, | 68 CancelableTask* launch_timeout = NewRunnableMethod(this, |
69 &CFProxy::LaunchTimeOut); | 69 &CFProxy::LaunchTimeOut); |
70 ipc_thread_.message_loop()->PostDelayedTask(FROM_HERE, launch_timeout, | 70 ipc_thread_.message_loop()->PostDelayedTask(FROM_HERE, launch_timeout, |
71 params.timeout.InMilliseconds()); | 71 params.timeout.InMilliseconds()); |
72 } else { | 72 } else { |
73 OnPeerLost(ChromeProxyDelegate::CHROME_EXE_LAUNCH_FAILED); | 73 OnPeerLost(ChromeProxyDelegate::CHROME_EXE_LAUNCH_FAILED); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void CFProxy::CleanupOnIoThread() { | 77 void CFProxy::CleanupOnIoThread() { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void CFProxy::OnChannelError() { | 213 void CFProxy::OnChannelError() { |
214 is_connected_ = false; | 214 is_connected_ = false; |
215 | 215 |
216 // Inform the sync message callbacks that there are not going to see | 216 // Inform the sync message callbacks that there are not going to see |
217 // any reply. | 217 // any reply. |
218 sync_dispatcher_.OnChannelClosed(); | 218 sync_dispatcher_.OnChannelClosed(); |
219 OnPeerLost(ChromeProxyDelegate::CHANNEL_ERROR); | 219 OnPeerLost(ChromeProxyDelegate::CHANNEL_ERROR); |
220 | 220 |
221 // TODO(stoyan): Relaunch? | 221 // TODO(stoyan): Relaunch? |
222 } | 222 } |
OLD | NEW |