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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 InvokeCallback<UnloadContext>(msg, context); | 129 InvokeCallback<UnloadContext>(msg, context); |
130 break; | 130 break; |
131 default: | 131 default: |
132 NOTREACHED(); | 132 NOTREACHED(); |
133 } | 133 } |
134 return true; | 134 return true; |
135 } | 135 } |
136 }; | 136 }; |
137 | 137 |
138 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( | 138 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( |
139 AutomationProxyCacheEntry* entry, int launch_timeout) | 139 AutomationProxyCacheEntry* entry, |
| 140 std::string channel_id, int launch_timeout) |
140 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { | 141 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { |
141 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); | 142 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); |
142 | 143 |
| 144 InitializeChannel(channel_id, false); |
| 145 |
143 sync_ = new CFMsgDispatcher(); | 146 sync_ = new CFMsgDispatcher(); |
144 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); | 147 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); |
145 | 148 |
146 // Order of filters is not important. | 149 // Order of filters is not important. |
147 channel_->AddFilter(message_filter_.get()); | 150 channel_->AddFilter(message_filter_.get()); |
148 channel_->AddFilter(sync_.get()); | 151 channel_->AddFilter(sync_.get()); |
149 } | 152 } |
150 | 153 |
151 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { | 154 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { |
152 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); | 155 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 DCHECK(delegate); | 259 DCHECK(delegate); |
257 DCHECK(params); | 260 DCHECK(params); |
258 DCHECK(proxy_.get() == NULL); | 261 DCHECK(proxy_.get() == NULL); |
259 | 262 |
260 // We *must* create automationproxy in a thread that has message loop, | 263 // We *must* create automationproxy in a thread that has message loop, |
261 // since SyncChannel::Context construction registers event to be watched | 264 // since SyncChannel::Context construction registers event to be watched |
262 // through ObjectWatcher which subscribes for the current thread message loop | 265 // through ObjectWatcher which subscribes for the current thread message loop |
263 // destruction notification. | 266 // destruction notification. |
264 | 267 |
265 // At same time we must destroy/stop the thread from another thread. | 268 // At same time we must destroy/stop the thread from another thread. |
| 269 std::string channel_id = AutomationProxy::GenerateChannelID(); |
266 ChromeFrameAutomationProxyImpl* proxy = | 270 ChromeFrameAutomationProxyImpl* proxy = |
267 new ChromeFrameAutomationProxyImpl(this, params->launch_timeout()); | 271 new ChromeFrameAutomationProxyImpl(this, channel_id, |
| 272 params->launch_timeout()); |
268 | 273 |
269 // Ensure that the automation proxy actually respects our choice on whether | 274 // Ensure that the automation proxy actually respects our choice on whether |
270 // or not to check the version. | 275 // or not to check the version. |
271 proxy->set_perform_version_check(params->version_check()); | 276 proxy->set_perform_version_check(params->version_check()); |
272 | 277 |
273 // Launch browser | 278 // Launch browser |
274 scoped_ptr<CommandLine> command_line( | 279 scoped_ptr<CommandLine> command_line( |
275 chrome_launcher::CreateLaunchCommandLine()); | 280 chrome_launcher::CreateLaunchCommandLine()); |
276 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID, | 281 command_line->AppendSwitchASCII(switches::kAutomationClientChannelID, |
277 proxy->channel_id()); | 282 channel_id); |
278 | 283 |
279 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths | 284 // Run Chrome in Chrome Frame mode. In practice, this modifies the paths |
280 // and registry keys that Chrome looks in via the BrowserDistribution | 285 // and registry keys that Chrome looks in via the BrowserDistribution |
281 // mechanism. | 286 // mechanism. |
282 command_line->AppendSwitch(switches::kChromeFrame); | 287 command_line->AppendSwitch(switches::kChromeFrame); |
283 | 288 |
284 // Chrome Frame never wants Chrome to start up with a First Run UI. | 289 // Chrome Frame never wants Chrome to start up with a First Run UI. |
285 command_line->AppendSwitch(switches::kNoFirstRun); | 290 command_line->AppendSwitch(switches::kNoFirstRun); |
286 | 291 |
287 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 292 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 const URLRequestStatus& status) { | 1458 const URLRequestStatus& status) { |
1454 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1459 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
1455 request_id, status)); | 1460 request_id, status)); |
1456 } | 1461 } |
1457 | 1462 |
1458 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1463 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1459 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1464 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1460 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1465 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
1461 tab_->handle(), success, url, cookie_string, cookie_id)); | 1466 tab_->handle(), success, url, cookie_string, cookie_id)); |
1462 } | 1467 } |
OLD | NEW |