summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.cc5
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.h7
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc36
-rw-r--r--chrome/browser/automation/url_request_automation_job.h6
-rw-r--r--chrome/browser/download/download_request_manager.cc8
-rw-r--r--chrome/browser/download/download_request_manager.h1
-rw-r--r--chrome/browser/download/download_request_manager_unittest.cc4
-rw-r--r--chrome/browser/external_tab_container.cc21
-rw-r--r--chrome/browser/external_tab_container.h3
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.cc4
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.h5
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc7
-rw-r--r--chrome/browser/tab_contents/tab_contents.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--chrome/test/automation/automation_messages_internal.h6
-rw-r--r--chrome_frame/chrome_frame_activex_base.h7
-rw-r--r--chrome_frame/chrome_frame_automation.cc26
-rw-r--r--chrome_frame/chrome_frame_automation.h2
-rw-r--r--chrome_frame/chrome_frame_delegate.cc3
-rw-r--r--chrome_frame/chrome_frame_delegate.h1
-rw-r--r--chrome_frame/chrome_frame_npapi.cc2
-rw-r--r--chrome_frame/plugin_url_request.cc5
-rw-r--r--chrome_frame/test/net/test_automation_provider.cc8
-rw-r--r--chrome_frame/test/net/test_automation_resource_message_filter.cc4
24 files changed, 130 insertions, 49 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index 953061e..e0512ca 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -20,7 +20,6 @@
AutomationResourceMessageFilter::RenderViewMap
AutomationResourceMessageFilter::filtered_render_views_;
-int AutomationResourceMessageFilter::unique_request_id_ = 1;
AutomationResourceMessageFilter::AutomationResourceMessageFilter()
: channel_(NULL) {
@@ -64,8 +63,8 @@ void AutomationResourceMessageFilter::OnChannelClosing() {
// Called on the IPC thread:
bool AutomationResourceMessageFilter::OnMessageReceived(
const IPC::Message& message) {
- int request_id = URLRequestAutomationJob::MayFilterMessage(message);
- if (request_id) {
+ int request_id;
+ if (URLRequestAutomationJob::MayFilterMessage(message, &request_id)) {
RequestMap::iterator it = request_map_.find(request_id);
if (it != request_map_.end()) {
URLRequestAutomationJob* job = it->second;
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h
index beb5fa8..ceb6115 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -39,10 +39,6 @@ class AutomationResourceMessageFilter
AutomationResourceMessageFilter();
virtual ~AutomationResourceMessageFilter();
- int NewRequestId() {
- return base::subtle::Barrier_AtomicIncrement(&unique_request_id_, 1);
- }
-
// IPC::ChannelProxy::MessageFilter methods:
virtual void OnFilterAdded(IPC::Channel* channel);
virtual void OnChannelConnected(int32 peer_pid);
@@ -98,9 +94,6 @@ class AutomationResourceMessageFilter
// owned by this class.
IPC::Channel* channel_;
- // A unique request id per process.
- static int unique_request_id_;
-
// Map of outstanding requests.
RequestMap request_map_;
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 715e292..ead7aab 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -49,17 +49,16 @@ URLRequest::ProtocolFactory* URLRequestAutomationJob::old_http_factory_
URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_
= NULL;
-URLRequestAutomationJob::URLRequestAutomationJob(
- URLRequest* request, int tab, AutomationResourceMessageFilter* filter)
- : URLRequestJob(request), id_(0), tab_(tab), message_filter_(filter),
- pending_buf_size_(0), redirect_status_(0) {
+URLRequestAutomationJob::URLRequestAutomationJob(URLRequest* request, int tab,
+ int request_id, AutomationResourceMessageFilter* filter)
+ : URLRequestJob(request),
+ id_(request_id),
+ tab_(tab),
+ message_filter_(filter),
+ pending_buf_size_(0),
+ redirect_status_(0) {
DLOG(INFO) << "URLRequestAutomationJob create. Count: " << ++instance_count_;
- if (message_filter_) {
- id_ = message_filter_->NewRequestId();
- DCHECK(id_);
- } else {
- NOTREACHED();
- }
+ DCHECK_NE(id_, -1);
}
URLRequestAutomationJob::~URLRequestAutomationJob() {
@@ -97,7 +96,7 @@ URLRequestJob* URLRequestAutomationJob::Factory(URLRequest* request,
if (AutomationResourceMessageFilter::LookupRegisteredRenderView(
request_info->child_id(), request_info->route_id(), &details)) {
URLRequestAutomationJob* job = new URLRequestAutomationJob(request,
- details.tab_handle, details.filter);
+ details.tab_handle, request_info->request_id(), details.filter);
return job;
}
}
@@ -202,23 +201,22 @@ bool URLRequestAutomationJob::IsRedirectResponse(
return false;
}
-int URLRequestAutomationJob::MayFilterMessage(const IPC::Message& message) {
+bool URLRequestAutomationJob::MayFilterMessage(const IPC::Message& message,
+ int* request_id) {
switch (message.type()) {
case AutomationMsg_RequestStarted::ID:
case AutomationMsg_RequestData::ID:
case AutomationMsg_RequestEnd::ID: {
void* iter = NULL;
int tab = 0;
- int id = 0;
- if (message.ReadInt(&iter, &tab) && message.ReadInt(&iter, &id)) {
- DCHECK(id);
- return id;
+ if (message.ReadInt(&iter, &tab) && message.ReadInt(&iter, request_id)) {
+ return true;
}
break;
}
}
- return 0;
+ return false;
}
void URLRequestAutomationJob::OnMessage(const IPC::Message& message) {
@@ -229,8 +227,8 @@ void URLRequestAutomationJob::OnMessage(const IPC::Message& message) {
IPC_END_MESSAGE_MAP()
}
-void URLRequestAutomationJob::OnRequestStarted(
- int tab, int id, const IPC::AutomationURLResponse& response) {
+void URLRequestAutomationJob::OnRequestStarted(int tab, int id,
+ const IPC::AutomationURLResponse& response) {
DLOG(INFO) << "URLRequestAutomationJob: " <<
request_->url().spec() << " - response started.";
set_expected_content_size(response.content_length);
diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h
index d4ed0f0..0edd876 100644
--- a/chrome/browser/automation/url_request_automation_job.h
+++ b/chrome/browser/automation/url_request_automation_job.h
@@ -22,8 +22,8 @@ struct AutomationURLResponse;
// automation.
class URLRequestAutomationJob : public URLRequestJob {
public:
- URLRequestAutomationJob(
- URLRequest* request, int tab, AutomationResourceMessageFilter* filter);
+ URLRequestAutomationJob(URLRequest* request, int tab, int request_id,
+ AutomationResourceMessageFilter* filter);
// Register our factory for HTTP/HTTPs requests.
static bool EnsureProtocolFactoryRegistered();
@@ -40,7 +40,7 @@ class URLRequestAutomationJob : public URLRequestJob {
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
// Peek and process automation messages for URL requests.
- static int MayFilterMessage(const IPC::Message& message);
+ static bool MayFilterMessage(const IPC::Message& message, int* request_id);
void OnMessage(const IPC::Message& message);
int id() const {
diff --git a/chrome/browser/download/download_request_manager.cc b/chrome/browser/download/download_request_manager.cc
index bcb4214..8cb21c9 100644
--- a/chrome/browser/download/download_request_manager.cc
+++ b/chrome/browser/download/download_request_manager.cc
@@ -227,6 +227,14 @@ void DownloadRequestManager::CanDownload(int render_process_host_id,
void DownloadRequestManager::CanDownloadImpl(
TabContents* originating_tab,
Callback* callback) {
+ // FYI: Chrome Frame overrides CanDownload in ExternalTabContainer in order
+ // to cancel the download operation in chrome and let the host browser
+ // take care of it.
+ if (!originating_tab->CanDownload(callback->GetRequestId())) {
+ ScheduleNotification(callback, false);
+ return;
+ }
+
// If the tab requesting the download is a constrained popup that is not
// shown, treat the request as if it came from the parent.
TabContents* effective_tab = originating_tab;
diff --git a/chrome/browser/download/download_request_manager.h b/chrome/browser/download/download_request_manager.h
index 2b03572..c8d4a34 100644
--- a/chrome/browser/download/download_request_manager.h
+++ b/chrome/browser/download/download_request_manager.h
@@ -56,6 +56,7 @@ class DownloadRequestManager :
public:
virtual void ContinueDownload() = 0;
virtual void CancelDownload() = 0;
+ virtual int GetRequestId() = 0;
};
// TabDownloadState maintains the download state for a particular tab.
diff --git a/chrome/browser/download/download_request_manager_unittest.cc b/chrome/browser/download/download_request_manager_unittest.cc
index c55bea4..bd52631 100644
--- a/chrome/browser/download/download_request_manager_unittest.cc
+++ b/chrome/browser/download/download_request_manager_unittest.cc
@@ -39,6 +39,10 @@ class DownloadRequestManagerTest
cancel_count_++;
}
+ virtual int GetRequestId() {
+ return -1;
+ }
+
void CanDownload() {
download_request_manager_->CanDownloadImpl(
controller().tab_contents(), this);
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index 4da768f..d200891 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/page_info_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/browser/tab_contents/provisional_load_details.h"
#include "chrome/browser/views/tab_contents/render_view_context_menu_external_win.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -394,12 +395,28 @@ bool ExternalTabContainer::TakeFocus(bool reverse) {
return true;
}
+bool ExternalTabContainer::CanDownload(int request_id) {
+ if (load_requests_via_automation_) {
+ if (automation_) {
+ // NOTE: The request_id must be the same id as used by corresponding
+ // URLRequestAutomationJob instance to communicate with the host.
+ automation_->Send(new AutomationMsg_DownloadRequestInHost(0, tab_handle_,
+ request_id));
+ }
+ } else {
+ DLOG(WARNING) << "Downloads are only supported with host browser network "
+ "stack enabled.";
+ }
+
+ // Never allow downloads.
+ return false;
+}
+
void ExternalTabContainer::ShowPageInfo(Profile* profile,
const GURL& url,
const NavigationEntry::SSLStatus& ssl,
bool show_history) {
- browser::ShowPageInfo(GetNativeView(), profile, url, ssl,
- show_history);
+ browser::ShowPageInfo(GetNativeView(), profile, url, ssl, show_history);
}
bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) {
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index 738cd0c..3c97233 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -122,6 +122,9 @@ class ExternalTabContainer : public TabContentsDelegate,
virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
virtual bool TakeFocus(bool reverse);
+
+ virtual bool CanDownload(int request_id);
+
virtual bool OnGoToEntryOffset(int offset);
virtual void ShowPageInfo(Profile* profile,
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.cc b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
index ee286db..b49bc87 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
@@ -148,6 +148,10 @@ void DownloadThrottlingResourceHandler::ContinueDownload() {
host_->PauseRequest(render_process_host_id_, request_id_, false);
}
+int DownloadThrottlingResourceHandler::GetRequestId() {
+ return request_id_;
+}
+
void DownloadThrottlingResourceHandler::CopyTmpBufferToDownloadHandler() {
// Copy over the tmp buffer.
net::IOBuffer* buffer;
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.h b/chrome/browser/renderer_host/download_throttling_resource_handler.h
index 8a110f3..3b04bd8 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.h
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.h
@@ -50,8 +50,9 @@ class DownloadThrottlingResourceHandler
const std::string& security_info);
// DownloadRequestManager::Callback implementation:
- void CancelDownload();
- void ContinueDownload();
+ virtual void CancelDownload();
+ virtual void ContinueDownload();
+ virtual int GetRequestId();
private:
virtual ~DownloadThrottlingResourceHandler();
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 4e45553..0d2ba96 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1034,6 +1034,13 @@ void TabContents::ToolbarSizeChanged(bool is_animating) {
d->ToolbarSizeChanged(this, is_animating);
}
+bool TabContents::CanDownload(int request_id) {
+ TabContentsDelegate* d = delegate();
+ if (d)
+ return d->CanDownload(request_id);
+ return true;
+}
+
void TabContents::OnStartDownload(DownloadItem* download) {
DCHECK(download);
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index ad5de2f..ee25ef3 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -435,6 +435,10 @@ class TabContents : public PageNavigator,
// Returns whether the extension shelf should be visible.
virtual bool IsExtensionShelfAlwaysVisible();
+ // Notifies the delegate that a download is about to be started.
+ // This notification is fired before a local temporary file has been created.
+ bool CanDownload(int request_id);
+
// Notifies the delegate that a download started.
void OnStartDownload(DownloadItem* download);
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index 5f084ed..f5fdfcf 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -186,6 +186,10 @@ class TabContentsDelegate {
return 0;
}
+ virtual bool CanDownload(int request_id) {
+ return true;
+ }
+
virtual void OnStartDownload(DownloadItem* download) {
}
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index e8f215c..f7ded561 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1162,4 +1162,10 @@ IPC_BEGIN_MESSAGES(Automation)
// gfx::Point - the location to move to
IPC_MESSAGE_ROUTED2(AutomationMsg_WindowMouseMove, int, gfx::Point)
+ // Called when requests should be downloaded using a host browser's
+ // download mechanism when chrome is being embedded.
+ IPC_MESSAGE_ROUTED2(AutomationMsg_DownloadRequestInHost,
+ int /* tab_handle */,
+ int /* request_id */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index 85432ef..4941bba 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -462,7 +462,12 @@ END_MSG_MAP()
virtual void OnRequestEnd(int tab_handle, int request_id,
const URLRequestStatus& status) {
- automation_client_->RemoveRequest(request_id, status.status(), true);
+ automation_client_->RemoveRequest(request_id, true);
+ }
+
+ virtual void OnDownloadRequestInHost(int tab_handle, int request_id) {
+ DLOG(INFO) << "TODO: Let the host browser handle this download";
+ automation_client_->RemoveRequest(request_id, false);
}
virtual void OnSetCookieAsync(int tab_handle, const GURL& url,
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 0cafc87..6b9acb8 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -255,7 +255,9 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry,
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
// useful for Chrome Frame users.
+#ifndef NDEBUG
command_line->AppendSwitch(switches::kNoErrorDialogs);
+#endif
command_line->AppendSwitch(switches::kEnableRendererAccessibility);
@@ -668,7 +670,7 @@ void ChromeFrameAutomationClient::InstallExtensionComplete(
const FilePath& crx_path,
void* user_data,
AutomationMsg_ExtensionResponseValues res) {
- DCHECK(PlatformThread::CurrentId() == ui_thread_id_);
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
if (chrome_frame_delegate_) {
chrome_frame_delegate_->OnExtensionInstalled(crx_path, user_data, res);
@@ -798,7 +800,7 @@ void ChromeFrameAutomationClient::LaunchComplete(
void ChromeFrameAutomationClient::InitializeComplete(
AutomationLaunchResult result) {
- DCHECK(PlatformThread::CurrentId() == ui_thread_id_);
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
std::string version = automation_server_->server_version();
if (result != AUTOMATION_SUCCESS) {
@@ -981,12 +983,19 @@ bool ChromeFrameAutomationClient::Send(IPC::Message* msg) {
}
bool ChromeFrameAutomationClient::AddRequest(PluginUrlRequest* request) {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+
if (!request) {
NOTREACHED();
return false;
}
- DCHECK(request_map_.end() == request_map_.find(request->id()));
+#ifndef NDEBUG
+ RequestMap::const_iterator it = request_map_.find(request->id());
+ scoped_refptr<PluginUrlRequest> other(request_map_.end() == it ?
+ NULL : (*it).second);
+ DCHECK(other.get() == NULL);
+#endif
request_map_[request->id()] = request;
return true;
}
@@ -1002,12 +1011,13 @@ bool ChromeFrameAutomationClient::ReadRequest(
}
void ChromeFrameAutomationClient::RemoveRequest(PluginUrlRequest* request) {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
DCHECK(request_map_.end() != request_map_.find(request->id()));
request_map_.erase(request->id());
}
-void ChromeFrameAutomationClient::RemoveRequest(
- int request_id, int reason, bool abort) {
+void ChromeFrameAutomationClient::RemoveRequest(int request_id, bool abort) {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
PluginUrlRequest* request = LookupRequest(request_id);
if (request) {
if (abort) {
@@ -1021,6 +1031,7 @@ void ChromeFrameAutomationClient::RemoveRequest(
PluginUrlRequest* ChromeFrameAutomationClient::LookupRequest(
int request_id) const {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
PluginUrlRequest* request = NULL;
RequestMap::const_iterator it = request_map_.find(request_id);
if (request_map_.end() != it)
@@ -1030,13 +1041,14 @@ PluginUrlRequest* ChromeFrameAutomationClient::LookupRequest(
bool ChromeFrameAutomationClient::IsValidRequest(
PluginUrlRequest* request) const {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
bool is_valid = false;
// if request is invalid then request->id() won't work
// hence perform reverse map lookup for validity of the
// request pointer.
if (request) {
for (RequestMap::const_iterator it = request_map_.begin();
- it != request_map_.end(); it++) {
+ it != request_map_.end(); it++) {
if (request == (*it).second) {
is_valid = true;
break;
@@ -1048,6 +1060,7 @@ bool ChromeFrameAutomationClient::IsValidRequest(
}
void ChromeFrameAutomationClient::CleanupRequests() {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
while (request_map_.size()) {
PluginUrlRequest* request = request_map_.begin()->second;
if (request) {
@@ -1061,6 +1074,7 @@ void ChromeFrameAutomationClient::CleanupRequests() {
}
void ChromeFrameAutomationClient::CleanupAsyncRequests() {
+ DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
RequestMap::iterator index = request_map_.begin();
while (index != request_map_.end()) {
PluginUrlRequest* request = (*index).second;
diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h
index 411fdb8..9d948a3 100644
--- a/chrome_frame/chrome_frame_automation.h
+++ b/chrome_frame/chrome_frame_automation.h
@@ -236,7 +236,7 @@ class ChromeFrameAutomationClient
// URL request related
bool ReadRequest(int request_id, int bytes_to_read);
- void RemoveRequest(int request_id, int reason, bool abort);
+ void RemoveRequest(int request_id, bool abort);
PluginUrlRequest* LookupRequest(int request_id) const;
bool IsValidRequest(PluginUrlRequest* request) const;
void CleanupRequests();
diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc
index 396d7a9..eb97186 100644
--- a/chrome_frame/chrome_frame_delegate.cc
+++ b/chrome_frame/chrome_frame_delegate.cc
@@ -22,6 +22,7 @@ bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message,
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestStart, )
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestRead, )
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestEnd, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DownloadRequestInHost, )
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_SetCookieAsync, )
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_AttachExternalTab, )
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestGoToHistoryEntryOffset, )
@@ -62,6 +63,8 @@ void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd)
+ IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
+ OnDownloadRequestInHost)
IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h
index bbdc99e..1742ad0 100644
--- a/chrome_frame/chrome_frame_delegate.h
+++ b/chrome_frame/chrome_frame_delegate.h
@@ -98,6 +98,7 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate {
int bytes_to_read) {}
virtual void OnRequestEnd(int tab_handle, int request_id,
const URLRequestStatus& status) {}
+ virtual void OnDownloadRequestInHost(int tab_handle, int request_id) {}
virtual void OnSetCookieAsync(int tab_handle, const GURL& url,
const std::string& cookie) {}
virtual void OnAttachExternalTab(int tab_handle, intptr_t cookie,
diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc
index ec324e0..343a46d 100644
--- a/chrome_frame/chrome_frame_npapi.cc
+++ b/chrome_frame/chrome_frame_npapi.cc
@@ -683,7 +683,7 @@ void ChromeFrameNPAPI::OnRequestRead(int tab_handle, int request_id,
void ChromeFrameNPAPI::OnRequestEnd(int tab_handle, int request_id,
const URLRequestStatus& status) {
- automation_client_->RemoveRequest(request_id, status.status(), true);
+ automation_client_->RemoveRequest(request_id, true);
}
void ChromeFrameNPAPI::OnSetCookieAsync(int tab_handle, const GURL& url,
diff --git a/chrome_frame/plugin_url_request.cc b/chrome_frame/plugin_url_request.cc
index 62a13f5..325ac44 100644
--- a/chrome_frame/plugin_url_request.cc
+++ b/chrome_frame/plugin_url_request.cc
@@ -8,7 +8,10 @@
#include "chrome_frame/np_browser_functions.h"
PluginUrlRequest::PluginUrlRequest()
- : request_handler_(NULL), tab_(0), remote_request_id_(0), post_data_len_(0),
+ : request_handler_(NULL),
+ tab_(0),
+ remote_request_id_(-1),
+ post_data_len_(0),
status_(URLRequestStatus::IO_PENDING),
frame_busting_enabled_(false) {
}
diff --git a/chrome_frame/test/net/test_automation_provider.cc b/chrome_frame/test/net/test_automation_provider.cc
index 3a56aa4..f1a3b13 100644
--- a/chrome_frame/test/net/test_automation_provider.cc
+++ b/chrome_frame/test/net/test_automation_provider.cc
@@ -69,8 +69,14 @@ URLRequestJob* TestAutomationProvider::MaybeIntercept(URLRequest* request) {
// and only intercept requests that belong to that thread.
if (request->GetUserData(NULL) == NULL) {
DCHECK(tab_handle_ != -1);
+ // We generate our own request id which is also what
+ // ResourceDispatcherHost does (well, the id is actually generated by
+ // ResourceDispatcher). Since these requests are divided into with
+ // and without userdata, we're OK. However, just to make debugging
+ // a little easier, we have a significantly higher start value.
+ static int new_id = 0x00100000;
URLRequestAutomationJob* job = new URLRequestAutomationJob(request,
- tab_handle_, filter_);
+ tab_handle_, new_id++, filter_);
return job;
}
}
diff --git a/chrome_frame/test/net/test_automation_resource_message_filter.cc b/chrome_frame/test/net/test_automation_resource_message_filter.cc
index 32ef532..f7f00bc 100644
--- a/chrome_frame/test/net/test_automation_resource_message_filter.cc
+++ b/chrome_frame/test/net/test_automation_resource_message_filter.cc
@@ -25,8 +25,8 @@ bool TestAutomationResourceMessageFilter::OnMessageReceived(
// for filter messages, send the message to the correct thread
// for URL requests.
bool handled = false;
- int request_id = URLRequestAutomationJob::MayFilterMessage(message);
- if (request_id) {
+ int request_id;
+ if (URLRequestAutomationJob::MayFilterMessage(message, &request_id)) {
RequestMap::iterator it = requests_.find(request_id);
if (it != requests_.end()) {
handled = true;