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/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 InvokeCallback<UnloadContext>(msg, context); | 137 InvokeCallback<UnloadContext>(msg, context); |
138 break; | 138 break; |
139 default: | 139 default: |
140 NOTREACHED(); | 140 NOTREACHED(); |
141 } | 141 } |
142 return true; | 142 return true; |
143 } | 143 } |
144 }; | 144 }; |
145 | 145 |
146 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( | 146 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( |
147 AutomationProxyCacheEntry* entry, int launch_timeout) | 147 AutomationProxyCacheEntry* entry, |
| 148 std::string channel_id, int launch_timeout) |
148 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { | 149 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { |
149 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); | 150 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); |
150 | 151 |
| 152 InitializeChannel(channel_id, false); |
| 153 |
151 sync_ = new CFMsgDispatcher(); | 154 sync_ = new CFMsgDispatcher(); |
152 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); | 155 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); |
153 | 156 |
154 // Order of filters is not important. | 157 // Order of filters is not important. |
155 channel_->AddFilter(message_filter_.get()); | 158 channel_->AddFilter(message_filter_.get()); |
156 channel_->AddFilter(sync_.get()); | 159 channel_->AddFilter(sync_.get()); |
157 } | 160 } |
158 | 161 |
159 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { | 162 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { |
160 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); | 163 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 DCHECK(delegate); | 267 DCHECK(delegate); |
265 DCHECK(params); | 268 DCHECK(params); |
266 DCHECK(proxy_.get() == NULL); | 269 DCHECK(proxy_.get() == NULL); |
267 | 270 |
268 // We *must* create automationproxy in a thread that has message loop, | 271 // We *must* create automationproxy in a thread that has message loop, |
269 // since SyncChannel::Context construction registers event to be watched | 272 // since SyncChannel::Context construction registers event to be watched |
270 // through ObjectWatcher which subscribes for the current thread message loop | 273 // through ObjectWatcher which subscribes for the current thread message loop |
271 // destruction notification. | 274 // destruction notification. |
272 | 275 |
273 // At same time we must destroy/stop the thread from another thread. | 276 // At same time we must destroy/stop the thread from another thread. |
| 277 std::string channel_id = AutomationProxy::GenerateChannelID(); |
274 ChromeFrameAutomationProxyImpl* proxy = | 278 ChromeFrameAutomationProxyImpl* proxy = |
275 new ChromeFrameAutomationProxyImpl(this, params->launch_timeout()); | 279 new ChromeFrameAutomationProxyImpl(this, channel_id, |
| 280 params->launch_timeout()); |
276 | 281 |
277 // Ensure that the automation proxy actually respects our choice on whether | 282 // Ensure that the automation proxy actually respects our choice on whether |
278 // or not to check the version. | 283 // or not to check the version. |
279 proxy->set_perform_version_check(params->version_check()); | 284 proxy->set_perform_version_check(params->version_check()); |
280 | 285 |
281 // Launch browser | 286 // Launch browser |
282 scoped_ptr<CommandLine> command_line( | 287 scoped_ptr<CommandLine> command_line( |
283 chrome_launcher::CreateLaunchCommandLine()); | 288 chrome_launcher::CreateLaunchCommandLine()); |
284 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID, | 289 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID, |
285 proxy->channel_id()); | 290 channel_id); |
286 | 291 |
287 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths | 292 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths |
288 // and registry keys that Chrome looks in via the BrowserDistribution | 293 // and registry keys that Chrome looks in via the BrowserDistribution |
289 // mechanism. | 294 // mechanism. |
290 command_line->AppendSwitch(switches::kChromeFrame); | 295 command_line->AppendSwitch(switches::kChromeFrame); |
291 | 296 |
292 // Chrome Frame never wants Chrome to start up with a First Run UI. | 297 // Chrome Frame never wants Chrome to start up with a First Run UI. |
293 command_line->AppendSwitch(switches::kNoFirstRun); | 298 command_line->AppendSwitch(switches::kNoFirstRun); |
294 | 299 |
295 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 300 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 const URLRequestStatus& status) { | 1468 const URLRequestStatus& status) { |
1464 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1469 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
1465 request_id, status)); | 1470 request_id, status)); |
1466 } | 1471 } |
1467 | 1472 |
1468 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1473 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1469 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1474 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1470 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1475 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
1471 tab_->handle(), success, url, cookie_string, cookie_id)); | 1476 tab_->handle(), success, url, cookie_string, cookie_id)); |
1472 } | 1477 } |
OLD | NEW |