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