diff options
Diffstat (limited to 'content/browser')
12 files changed, 70 insertions, 35 deletions
diff --git a/content/browser/loader/resource_request_info_impl.cc b/content/browser/loader/resource_request_info_impl.cc index 32ba7ac..c1ccc91 100644 --- a/content/browser/loader/resource_request_info_impl.cc +++ b/content/browser/loader/resource_request_info_impl.cc @@ -57,16 +57,16 @@ void ResourceRequestInfo::AllocateForTesting( } // static -bool ResourceRequestInfo::GetRenderViewForRequest( +bool ResourceRequestInfo::GetRenderFrameForRequest( const net::URLRequest* request, int* render_process_id, - int* render_view_id) { + int* render_frame_id) { URLRequestUserData* user_data = static_cast<URLRequestUserData*>( request->GetUserData(URLRequestUserData::kUserDataKey)); if (!user_data) return false; *render_process_id = user_data->render_process_id(); - *render_view_id = user_data->render_view_id(); + *render_frame_id = user_data->render_frame_id(); return true; } @@ -205,8 +205,9 @@ bool ResourceRequestInfoImpl::GetAssociatedRenderView( if (process_type_ == PROCESS_TYPE_WORKER) { // Need to display some related UI for this network request - pick an // arbitrary parent to do so. + int unused; if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( - child_id_, render_process_id, render_view_id)) { + child_id_, render_process_id, render_view_id, &unused)) { *render_process_id = -1; *render_view_id = -1; return false; @@ -221,6 +222,31 @@ bool ResourceRequestInfoImpl::GetAssociatedRenderView( return true; } +bool ResourceRequestInfoImpl::GetAssociatedRenderFrame( + int* render_process_id, + int* render_frame_id) const { + // If the request is from the worker process, find a content that owns the + // worker. + if (process_type_ == PROCESS_TYPE_WORKER) { + // Need to display some related UI for this network request - pick an + // arbitrary parent to do so. + int unused; + if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( + child_id_, render_process_id, &unused, render_frame_id)) { + *render_process_id = -1; + *render_frame_id = -1; + return false; + } + } else if (process_type_ == PROCESS_TYPE_PLUGIN) { + *render_process_id = origin_pid_; + *render_frame_id = render_frame_id_; + } else { + *render_process_id = child_id_; + *render_frame_id = render_frame_id_; + } + return true; +} + bool ResourceRequestInfoImpl::IsAsync() const { return is_async_; } @@ -232,11 +258,11 @@ bool ResourceRequestInfoImpl::IsDownload() const { void ResourceRequestInfoImpl::AssociateWithRequest(net::URLRequest* request) { request->SetUserData(NULL, this); int render_process_id; - int render_view_id; - if (GetAssociatedRenderView(&render_process_id, &render_view_id)) { + int render_frame_id; + if (GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) { request->SetUserData( URLRequestUserData::kUserDataKey, - new URLRequestUserData(render_process_id, render_view_id)); + new URLRequestUserData(render_process_id, render_frame_id)); } } diff --git a/content/browser/loader/resource_request_info_impl.h b/content/browser/loader/resource_request_info_impl.h index 2635106..6327e9a 100644 --- a/content/browser/loader/resource_request_info_impl.h +++ b/content/browser/loader/resource_request_info_impl.h @@ -81,6 +81,8 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo, virtual bool WasIgnoredByHandler() const OVERRIDE; virtual bool GetAssociatedRenderView(int* render_process_id, int* render_view_id) const OVERRIDE; + virtual bool GetAssociatedRenderFrame(int* render_process_id, + int* render_frame_id) const OVERRIDE; virtual bool IsAsync() const OVERRIDE; virtual bool IsDownload() const OVERRIDE; diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index fc084e1..429aef8 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -564,7 +564,7 @@ void RenderMessageFilter::OnGetProcessMemorySizes(size_t* private_bytes, } } -void RenderMessageFilter::OnSetCookie(const IPC::Message& message, +void RenderMessageFilter::OnSetCookie(int render_frame_id, const GURL& url, const GURL& first_party_for_cookies, const std::string& cookie) { @@ -575,9 +575,8 @@ void RenderMessageFilter::OnSetCookie(const IPC::Message& message, net::CookieOptions options; if (GetContentClient()->browser()->AllowSetCookie( - url, first_party_for_cookies, cookie, - resource_context_, render_process_id_, message.routing_id(), - &options)) { + url, first_party_for_cookies, cookie, resource_context_, + render_process_id_, render_frame_id, &options)) { net::URLRequestContext* context = GetRequestContextForURL(url); // Pass a null callback since we don't care about when the 'set' completes. context->cookie_store()->SetCookieWithOptionsAsync( @@ -585,7 +584,8 @@ void RenderMessageFilter::OnSetCookie(const IPC::Message& message, } } -void RenderMessageFilter::OnGetCookies(const GURL& url, +void RenderMessageFilter::OnGetCookies(int render_frame_id, + const GURL& url, const GURL& first_party_for_cookies, IPC::Message* reply_msg) { ChildProcessSecurityPolicyImpl* policy = @@ -605,8 +605,9 @@ void RenderMessageFilter::OnGetCookies(const GURL& url, net::CookieMonster* cookie_monster = context->cookie_store()->GetCookieMonster(); cookie_monster->GetAllCookiesForURLAsync( - url, base::Bind(&RenderMessageFilter::CheckPolicyForCookies, this, url, - first_party_for_cookies, reply_msg)); + url, base::Bind(&RenderMessageFilter::CheckPolicyForCookies, this, + render_frame_id, url, first_party_for_cookies, + reply_msg)); } void RenderMessageFilter::OnGetRawCookies( @@ -1034,6 +1035,7 @@ void RenderMessageFilter::OnMediaLogEvents( } void RenderMessageFilter::CheckPolicyForCookies( + int render_frame_id, const GURL& url, const GURL& first_party_for_cookies, IPC::Message* reply_msg, @@ -1043,7 +1045,7 @@ void RenderMessageFilter::CheckPolicyForCookies( // TabSpecificContentSetting for logging purpose. if (GetContentClient()->browser()->AllowGetCookie( url, first_party_for_cookies, cookie_list, resource_context_, - render_process_id_, reply_msg->routing_id())) { + render_process_id_, render_frame_id)) { // Gets the cookies from cookie store if allowed. context->cookie_store()->GetCookiesWithOptionsAsync( url, net::CookieOptions(), diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index ed879dc..d23d9b7 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -134,11 +134,12 @@ class RenderMessageFilter : public BrowserMessageFilter { void OnCreateFullscreenWidget(int opener_id, int* route_id, int* surface_id); - void OnSetCookie(const IPC::Message& message, + void OnSetCookie(int render_frame_id, const GURL& url, const GURL& first_party_for_cookies, const std::string& cookie); - void OnGetCookies(const GURL& url, + void OnGetCookies(int render_frame_id, + const GURL& url, const GURL& first_party_for_cookies, IPC::Message* reply_msg); void OnGetRawCookies(const GURL& url, @@ -230,7 +231,8 @@ class RenderMessageFilter : public BrowserMessageFilter { void OnMediaLogEvents(const std::vector<media::MediaLogEvent>&); // Check the policy for getting cookies. Gets the cookies if allowed. - void CheckPolicyForCookies(const GURL& url, + void CheckPolicyForCookies(int render_frame_id, + const GURL& url, const GURL& first_party_for_cookies, IPC::Message* reply_msg, const net::CookieList& cookie_list); diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc index 45ddc79..aa1dc39 100644 --- a/content/browser/webui/shared_resources_data_source.cc +++ b/content/browser/webui/shared_resources_data_source.cc @@ -69,7 +69,7 @@ std::string SharedResourcesDataSource::GetSource() const { void SharedResourcesDataSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { int idr = PathToIDR(path); DCHECK_NE(-1, idr) << " path: " << path; diff --git a/content/browser/webui/shared_resources_data_source.h b/content/browser/webui/shared_resources_data_source.h index cf9c24c6..9c3a3c4 100644 --- a/content/browser/webui/shared_resources_data_source.h +++ b/content/browser/webui/shared_resources_data_source.h @@ -19,7 +19,7 @@ class SharedResourcesDataSource : public content::URLDataSource { virtual void StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) OVERRIDE; virtual std::string GetMimeType(const std::string&) const OVERRIDE; diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc index 1e37800..128e023 100644 --- a/content/browser/webui/url_data_manager_backend.cc +++ b/content/browser/webui/url_data_manager_backend.cc @@ -532,10 +532,10 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, // Look up additional request info to pass down. int render_process_id = -1; - int render_view_id = -1; - ResourceRequestInfo::GetRenderViewForRequest(request, - &render_process_id, - &render_view_id); + int render_frame_id = -1; + ResourceRequestInfo::GetRenderFrameForRequest(request, + &render_process_id, + &render_frame_id); // Forward along the request to the data source. base::MessageLoop* target_message_loop = @@ -549,7 +549,7 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, // on for this path. Call directly into it from this thread, the IO // thread. source->source()->StartDataRequest( - path, render_process_id, render_view_id, + path, render_process_id, render_frame_id, base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); } else { // URLRequestChromeJob should receive mime type before data. This @@ -568,7 +568,7 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, FROM_HERE, base::Bind(&URLDataManagerBackend::CallStartRequest, make_scoped_refptr(source), path, render_process_id, - render_view_id, request_id)); + render_frame_id, request_id)); } return true; } @@ -577,7 +577,7 @@ void URLDataManagerBackend::CallStartRequest( scoped_refptr<URLDataSourceImpl> source, const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, int request_id) { if (BrowserThread::CurrentlyOn(BrowserThread::UI) && render_process_id != -1 && @@ -591,7 +591,7 @@ void URLDataManagerBackend::CallStartRequest( source->source()->StartDataRequest( path, render_process_id, - render_view_id, + render_frame_id, base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); } diff --git a/content/browser/webui/url_data_manager_backend.h b/content/browser/webui/url_data_manager_backend.h index e38fe1e..5d9ce28 100644 --- a/content/browser/webui/url_data_manager_backend.h +++ b/content/browser/webui/url_data_manager_backend.h @@ -77,7 +77,7 @@ class URLDataManagerBackend : public base::SupportsUserData::Data { static void CallStartRequest(scoped_refptr<URLDataSourceImpl> source, const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, int request_id); // Remove a request from the list of pending requests. diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc index 6775eb7..d6cff75 100644 --- a/content/browser/webui/web_ui_data_source_impl.cc +++ b/content/browser/webui/web_ui_data_source_impl.cc @@ -44,9 +44,9 @@ class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { virtual void StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const URLDataSource::GotDataCallback& callback) OVERRIDE { - return parent_->StartDataRequest(path, render_process_id, render_view_id, + return parent_->StartDataRequest(path, render_process_id, render_frame_id, callback); } virtual bool ShouldReplaceExistingSource() const OVERRIDE { @@ -188,7 +188,7 @@ std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const { void WebUIDataSourceImpl::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const URLDataSource::GotDataCallback& callback) { if (!filter_callback_.is_null() && filter_callback_.Run(path, callback)) { diff --git a/content/browser/webui/web_ui_data_source_impl.h b/content/browser/webui/web_ui_data_source_impl.h index 91ec087..9a01589 100644 --- a/content/browser/webui/web_ui_data_source_impl.h +++ b/content/browser/webui/web_ui_data_source_impl.h @@ -76,7 +76,7 @@ class CONTENT_EXPORT WebUIDataSourceImpl void StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const URLDataSource::GotDataCallback& callback); void disable_set_font_strings_for_testing() { diff --git a/content/browser/worker_host/worker_service_impl.cc b/content/browser/worker_host/worker_service_impl.cc index 03c4fb9..6b0b8f8 100644 --- a/content/browser/worker_host/worker_service_impl.cc +++ b/content/browser/worker_host/worker_service_impl.cc @@ -579,7 +579,8 @@ void WorkerServiceImpl::TryStartingQueuedWorker() { bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id, int* render_process_id, - int* render_view_id) const { + int* render_view_id, + int* render_frame_id) const { for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) { if (iter.GetData().id != worker_process_id) continue; @@ -594,6 +595,7 @@ bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id, first_instance->worker_document_set()->documents().begin(); *render_process_id = info->render_process_id(); *render_view_id = info->render_view_id(); + *render_frame_id = info->render_frame_id(); return true; } return false; diff --git a/content/browser/worker_host/worker_service_impl.h b/content/browser/worker_host/worker_service_impl.h index de5c462..4053403 100644 --- a/content/browser/worker_host/worker_service_impl.h +++ b/content/browser/worker_host/worker_service_impl.h @@ -68,7 +68,8 @@ class CONTENT_EXPORT WorkerServiceImpl // is how it is today until V8 can run in separate threads. bool GetRendererForWorker(int worker_process_id, int* render_process_id, - int* render_view_id) const; + int* render_view_id, + int* render_frame_id) const; const WorkerProcessHost::WorkerInstance* FindWorkerInstance( int worker_process_id); |