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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 PostTask(FROM_HERE, NewRunnableMethod(this, | 1161 PostTask(FROM_HERE, NewRunnableMethod(this, |
1162 &ChromeFrameAutomationClient::ProcessUrlRequestMessage, tab, msg, true)); | 1162 &ChromeFrameAutomationClient::ProcessUrlRequestMessage, tab, msg, true)); |
1163 return true; | 1163 return true; |
1164 } | 1164 } |
1165 | 1165 |
1166 // These are invoked in channel's background thread. | 1166 // These are invoked in channel's background thread. |
1167 // Cannot call any method of the activex/npapi here since they are STA | 1167 // Cannot call any method of the activex/npapi here since they are STA |
1168 // kind of beings. | 1168 // kind of beings. |
1169 // By default we marshal the IPC message to the main/GUI thread and from there | 1169 // By default we marshal the IPC message to the main/GUI thread and from there |
1170 // we safely invoke chrome_frame_delegate_->OnMessageReceived(msg). | 1170 // we safely invoke chrome_frame_delegate_->OnMessageReceived(msg). |
1171 bool ChromeFrameAutomationClient::OnMessageReceived(TabProxy* tab, | 1171 void ChromeFrameAutomationClient::OnMessageReceived(TabProxy* tab, |
1172 const IPC::Message& msg) { | 1172 const IPC::Message& msg) { |
1173 DCHECK(tab == tab_.get()); | 1173 DCHECK(tab == tab_.get()); |
1174 // Quickly process network related messages. | 1174 // Quickly process network related messages. |
1175 if (url_fetcher_ && ProcessUrlRequestMessage(tab, msg, false)) | 1175 if (url_fetcher_ && ProcessUrlRequestMessage(tab, msg, false)) |
1176 return true; | 1176 return; |
1177 | 1177 |
1178 // Early check to avoid needless marshaling | 1178 // Early check to avoid needless marshaling |
1179 if (chrome_frame_delegate_ == NULL) | 1179 if (chrome_frame_delegate_ == NULL) |
1180 return false; | 1180 return; |
1181 | 1181 |
1182 PostTask(FROM_HERE, NewRunnableMethod(this, | 1182 PostTask(FROM_HERE, NewRunnableMethod(this, |
1183 &ChromeFrameAutomationClient::OnMessageReceivedUIThread, msg)); | 1183 &ChromeFrameAutomationClient::OnMessageReceivedUIThread, msg)); |
1184 return true; | |
1185 } | 1184 } |
1186 | 1185 |
1187 void ChromeFrameAutomationClient::OnChannelError(TabProxy* tab) { | 1186 void ChromeFrameAutomationClient::OnChannelError(TabProxy* tab) { |
1188 DCHECK(tab == tab_.get()); | 1187 DCHECK(tab == tab_.get()); |
1189 // Early check to avoid needless marshaling | 1188 // Early check to avoid needless marshaling |
1190 if (chrome_frame_delegate_ == NULL) | 1189 if (chrome_frame_delegate_ == NULL) |
1191 return; | 1190 return; |
1192 | 1191 |
1193 PostTask(FROM_HERE, NewRunnableMethod(this, | 1192 PostTask(FROM_HERE, NewRunnableMethod(this, |
1194 &ChromeFrameAutomationClient::OnChannelErrorUIThread)); | 1193 &ChromeFrameAutomationClient::OnChannelErrorUIThread)); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 const URLRequestStatus& status) { | 1455 const URLRequestStatus& status) { |
1457 automation_server_->Send(new AutomationMsg_RequestEnd( | 1456 automation_server_->Send(new AutomationMsg_RequestEnd( |
1458 tab_->handle(), request_id, status)); | 1457 tab_->handle(), request_id, status)); |
1459 } | 1458 } |
1460 | 1459 |
1461 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1460 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1462 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1461 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1463 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( | 1462 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( |
1464 tab_->handle(), success, url, cookie_string, cookie_id)); | 1463 tab_->handle(), success, url, cookie_string, cookie_id)); |
1465 } | 1464 } |
OLD | NEW |