diff --git a/runtime/android/core_internal/src/org/xwalk/core/internal/XWalkContentsClientBridge.java b/runtime/android/core_internal/src/org/xwalk/core/internal/XWalkContentsClientBridge.java index e33d52b354..112baac8fc 100644 --- a/runtime/android/core_internal/src/org/xwalk/core/internal/XWalkContentsClientBridge.java +++ b/runtime/android/core_internal/src/org/xwalk/core/internal/XWalkContentsClientBridge.java @@ -373,12 +373,16 @@ public void onDownloadStart(String url, String contentDisposition, String mimeType, long contentLength) { + if (mDownloadListener != null) { + mDownloadListener.onDownloadStart(url, userAgent, contentDisposition, + mimeType, contentLength); + } } @Override public boolean onCreateWindow(boolean isDialog, boolean isUserGesture) { if (isDialog) return false; - + XWalkUIClientInternal.InitiateByInternal initiator = XWalkUIClientInternal.InitiateByInternal.BY_JAVASCRIPT; if (isUserGesture) { diff --git a/runtime/browser/android/xwalk_contents_io_thread_client_impl.cc b/runtime/browser/android/xwalk_contents_io_thread_client_impl.cc index 51fd5fa7a4..82de5a593a 100644 --- a/runtime/browser/android/xwalk_contents_io_thread_client_impl.cc +++ b/runtime/browser/android/xwalk_contents_io_thread_client_impl.cc @@ -89,8 +89,21 @@ void RfhToIoThreadClientMap::Set(pair rfh_id, bool RfhToIoThreadClientMap::Get( pair rfh_id, IoThreadClientData* client) { base::AutoLock lock(map_lock_); - RenderFrameHostToIoThreadClientType::iterator iterator = - rfh_to_io_thread_client_.find(rfh_id); + RenderFrameHostToIoThreadClientType::iterator iterator; + + if (rfh_id.second != MSG_ROUTING_NONE) { + iterator = rfh_to_io_thread_client_.find(rfh_id); + } else { + // Content use render_frame_id= MSG_ROUTING_NONE for download request + // So just find the matched process_id + iterator = rfh_to_io_thread_client_.begin(); + while (iterator != rfh_to_io_thread_client_.end()) { + if (iterator->first.first == rfh_id.first) + break; + iterator++; + } + } + if (iterator == rfh_to_io_thread_client_.end()) return false; diff --git a/runtime/browser/runtime_download_manager_delegate.cc b/runtime/browser/runtime_download_manager_delegate.cc index baa63bfd92..4602be4357 100644 --- a/runtime/browser/runtime_download_manager_delegate.cc +++ b/runtime/browser/runtime_download_manager_delegate.cc @@ -164,7 +164,7 @@ void RuntimeDownloadManagerDelegate::ChooseDownloadPath( if (GetSaveFileName(&save_as)) result = base::FilePath(std::wstring(save_as.lpstrFile)); #else - NOTIMPLEMENTED(); + result = suggested_path; #endif callback.Run(result, content::DownloadItem::TARGET_DISPOSITION_PROMPT, diff --git a/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc b/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc index ba63063c60..e5a816df08 100644 --- a/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc +++ b/runtime/browser/runtime_resource_dispatcher_host_delegate_android.cc @@ -259,8 +259,6 @@ void RuntimeResourceDispatcherHostDelegateAndroid::DownloadStarting( response_headers->GetMimeType(&mime_type); } - request->Cancel(); - const content::ResourceRequestInfo* request_info = content::ResourceRequestInfo::ForRequest(request);