using content::ResourceController;
using web_contents_utils::WebContentsFromFrameID;
+using web_contents_utils::WebContentsFromViewID;
using web_contents_utils::WebViewFromWebContents;
ResourceRequestInfo::GetRenderFrameForRequest(request, &render_process_id_, &render_frame_id_);
}
- /*
- * In some situations there is no render_process and render_frame associated with
- * request. Such situation happens in TC utc_blink_ewk_geolocation_permission_request_suspend_func
- */
- //DCHECK(render_process_id_ > 0);
- //DCHECK(render_frame_id_ > 0 || render_view_id_ > 0);
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ // Chromium internal downloads are not associated with any frame or view, we should
+ // accept them without EWK-specific logic. For example notification icon is internal
+ // chromium download
+ if (render_process_id_ > 0 && (render_frame_id_ > 0 || render_view_id_ > 0)) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&PolicyResponseDelegateEfl::HandlePolicyResponseOnUIThread, this));
+ } else {
+ // Async call required!
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&PolicyResponseDelegateEfl::UseResponseOnIOThread, this));
+ }
}
void PolicyResponseDelegateEfl::HandlePolicyResponseOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(policy_decision_.get());
- WebContents* web_contents = WebContentsFromFrameID(
+ WebContents* web_contents = NULL;
+
+ DCHECK(render_process_id_ > 0);
+ DCHECK(render_frame_id_ > 0 || render_view_id_ > 0);
+
+ if (render_frame_id_ > 0) {
+ web_contents = WebContentsFromFrameID(
render_process_id_, render_frame_id_);
- DCHECK(web_contents);
+ } else {
+ web_contents = WebContentsFromViewID(render_process_id_, render_view_id_);
+ }
+
+ if (!web_contents) {
+ // this is a situation where we had frame/view info on IO thread but it
+ // does not exist now in UI. We'll ignore such responses
+ IgnoreResponse();
+ return;
+ }
+
content::BrowserContextEfl* browser_context =
static_cast<content::BrowserContextEfl*>(
web_contents->GetBrowserContext());