diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 23:17:16 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 23:17:16 +0000 |
commit | f3add92d73df86fa62bf727b0016e0c62149b326 (patch) | |
tree | f2d0012dd68061378276814f1c5108e010bda7a5 /content | |
parent | 13c3497e0bf749e2bf9bb4e0112bf7b1bab63933 (diff) | |
download | chromium_src-f3add92d73df86fa62bf727b0016e0c62149b326.zip chromium_src-f3add92d73df86fa62bf727b0016e0c62149b326.tar.gz chromium_src-f3add92d73df86fa62bf727b0016e0c62149b326.tar.bz2 |
A bunch of work to transition from render_view_id to render_frame_id.
-remove ResourceRequestInfo::GetRenderViewForRequest
-reduce usage of GetAssociatedRenderView and add GetAssociatedRenderFrame which will replace it
-move the cookie jar from RenderView to RenderFrame
-switch most of the usages of RenderView to RenderFrame in WebPluginImpl
BUG=304341
R=boliu@chromium.org, nasko@chromium.org
Review URL: https://codereview.chromium.org/114573003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
38 files changed, 149 insertions, 115 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); diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc index b4ca047..9a1d1d4 100644 --- a/content/child/npapi/plugin_url_fetcher.cc +++ b/content/child/npapi/plugin_url_fetcher.cc @@ -79,7 +79,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream, bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id, + int render_frame_id, unsigned long resource_id) : plugin_stream_(plugin_stream), url_(url), @@ -99,7 +99,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream, request_info.load_flags = net::LOAD_NORMAL; request_info.requestor_pid = origin_pid; request_info.request_type = ResourceType::OBJECT; - request_info.routing_id = render_view_id; + request_info.routing_id = render_frame_id; std::vector<char> body; if (method == "POST") { diff --git a/content/child/npapi/plugin_url_fetcher.h b/content/child/npapi/plugin_url_fetcher.h index 45dcf36..b7cf4ec 100644 --- a/content/child/npapi/plugin_url_fetcher.h +++ b/content/child/npapi/plugin_url_fetcher.h @@ -32,7 +32,7 @@ class PluginURLFetcher : public webkit_glue::ResourceLoaderBridge::Peer { bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id, + int render_frame_id, unsigned long resource_id); virtual ~PluginURLFetcher(); diff --git a/content/child/npapi/webplugin_delegate.h b/content/child/npapi/webplugin_delegate.h index c419a3f..0a647be 100644 --- a/content/child/npapi/webplugin_delegate.h +++ b/content/child/npapi/webplugin_delegate.h @@ -142,7 +142,7 @@ class WebPluginDelegate { bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id) = 0; + int render_frame_id) = 0; }; diff --git a/content/child/npapi/webplugin_delegate_impl.cc b/content/child/npapi/webplugin_delegate_impl.cc index b9e64a7..dc56e68 100644 --- a/content/child/npapi/webplugin_delegate_impl.cc +++ b/content/child/npapi/webplugin_delegate_impl.cc @@ -310,7 +310,7 @@ void WebPluginDelegateImpl::FetchURL(unsigned long resource_id, bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id) { + int render_frame_id) { // TODO(jam): once we switch over to resource loading always happening in this // code path, remove WebPluginResourceClient abstraction. PluginStreamUrl* plugin_stream = instance()->CreateStream( @@ -319,7 +319,7 @@ void WebPluginDelegateImpl::FetchURL(unsigned long resource_id, plugin_stream->SetPluginURLFetcher(new PluginURLFetcher( plugin_stream, url, first_party_for_cookies, method, buf, len, referrer, notify_redirects, is_plugin_src_load, origin_pid, - render_view_id, resource_id)); + render_frame_id, resource_id)); } } // namespace content diff --git a/content/child/npapi/webplugin_delegate_impl.h b/content/child/npapi/webplugin_delegate_impl.h index e3bfc46..e072b6c 100644 --- a/content/child/npapi/webplugin_delegate_impl.h +++ b/content/child/npapi/webplugin_delegate_impl.h @@ -128,7 +128,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id) OVERRIDE; + int render_frame_id) OVERRIDE; // End of WebPluginDelegate implementation. gfx::PluginWindowHandle windowed_handle() const { return windowed_handle_; } diff --git a/content/child/plugin_messages.h b/content/child/plugin_messages.h index 92651e9..3a97d10 100644 --- a/content/child/plugin_messages.h +++ b/content/child/plugin_messages.h @@ -62,7 +62,7 @@ IPC_STRUCT_BEGIN(PluginMsg_FetchURL_Params) IPC_STRUCT_MEMBER(GURL, referrer) IPC_STRUCT_MEMBER(bool, notify_redirect) IPC_STRUCT_MEMBER(bool, is_plugin_src_load) - IPC_STRUCT_MEMBER(int, render_view_id) + IPC_STRUCT_MEMBER(int, render_frame_id) IPC_STRUCT_END() IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param) diff --git a/content/common/net/url_fetcher.cc b/content/common/net/url_fetcher.cc index 2a46be9..0433c61 100644 --- a/content/common/net/url_fetcher.cc +++ b/content/common/net/url_fetcher.cc @@ -20,15 +20,15 @@ base::SupportsUserData::Data* CreateURLRequestUserData( } // namespace -void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, - const GURL& first_party_for_cookies, - int render_process_id, - int render_view_id) { +void AssociateURLFetcherWithRenderFrame(net::URLFetcher* url_fetcher, + const GURL& first_party_for_cookies, + int render_process_id, + int render_frame_id) { url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); url_fetcher->SetURLRequestUserData( URLRequestUserData::kUserDataKey, base::Bind(&CreateURLRequestUserData, - render_process_id, render_view_id)); + render_process_id, render_frame_id)); } } // namespace content diff --git a/content/common/net/url_request_user_data.cc b/content/common/net/url_request_user_data.cc index 3394c58..9a0ccb5 100644 --- a/content/common/net/url_request_user_data.cc +++ b/content/common/net/url_request_user_data.cc @@ -7,9 +7,9 @@ namespace content { URLRequestUserData::URLRequestUserData(int render_process_id, - int render_view_id) + int render_frame_id) : render_process_id_(render_process_id), - render_view_id_(render_view_id) {} + render_frame_id_(render_frame_id) {} URLRequestUserData::~URLRequestUserData() {} diff --git a/content/common/net/url_request_user_data.h b/content/common/net/url_request_user_data.h index c3e464f..f540bec 100644 --- a/content/common/net/url_request_user_data.h +++ b/content/common/net/url_request_user_data.h @@ -13,17 +13,18 @@ namespace content { // with a given render view. class URLRequestUserData : public base::SupportsUserData::Data { public: - URLRequestUserData(int render_process_id, int render_view_id); + URLRequestUserData(int render_process_id, + int render_frame_id); virtual ~URLRequestUserData(); int render_process_id() const { return render_process_id_; } - int render_view_id() const { return render_view_id_; } + int render_frame_id() const { return render_frame_id_; } static const void* kUserDataKey; private: int render_process_id_; - int render_view_id_; + int render_frame_id_; }; } // namespace content diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 37af7c7..73bf9ea 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1688,17 +1688,19 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_SetCursor, // Used to set a cookie. The cookie is set asynchronously, but will be // available to a subsequent ViewHostMsg_GetCookies request. -IPC_MESSAGE_ROUTED3(ViewHostMsg_SetCookie, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookie */) +IPC_MESSAGE_CONTROL4(ViewHostMsg_SetCookie, + int /* render_frame_id */, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookie */) // Used to get cookies for the given URL. This may block waiting for a // previous SetCookie message to be processed. -IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetCookies, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookies */) +IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_GetCookies, + int /* render_frame_id */, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookies */) // Used to get raw cookie information for the given URL. This may block // waiting for a previous SetCookie message to be processed. diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index fd4827d..6122017 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -444,7 +444,7 @@ void WebPluginDelegateStub::OnFetchURL( params.notify_redirect, params.is_plugin_src_load, channel_->renderer_id(), - params.render_view_id); + params.render_frame_id); } } // namespace content diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index a55412d..c669268 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -121,7 +121,7 @@ bool ContentBrowserClient::AllowGetCookie(const GURL& url, const net::CookieList& cookie_list, ResourceContext* context, int render_process_id, - int render_view_id) { + int render_frame_id) { return true; } @@ -130,7 +130,7 @@ bool ContentBrowserClient::AllowSetCookie(const GURL& url, const std::string& cookie_line, ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) { return true; } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index dea60d9..c87f31c2 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -290,7 +290,7 @@ class CONTENT_EXPORT ContentBrowserClient { const net::CookieList& cookie_list, ResourceContext* context, int render_process_id, - int render_view_id); + int render_frame_id); // Allow the embedder to control if the given cookie can be set. // This is called on the IO thread. @@ -299,7 +299,7 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& cookie_line, ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options); // This is called on the IO thread. diff --git a/content/public/browser/resource_request_details.cc b/content/public/browser/resource_request_details.cc index 06badaf..2a30d89 100644 --- a/content/public/browser/resource_request_details.cc +++ b/content/public/browser/resource_request_details.cc @@ -33,9 +33,10 @@ ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request, // of ssl state change (http://crbug.com/25357). For now, just notify // the first one (works for dedicated workers and shared workers with // a single process). - int render_frame_id; + int render_view_id, render_frame_id; if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( - info->GetChildID(), &origin_child_id, &render_frame_id)) { + info->GetChildID(), &origin_child_id, &render_view_id, + &render_frame_id)) { origin_child_id = info->GetChildID(); } } diff --git a/content/public/browser/resource_request_info.h b/content/public/browser/resource_request_info.h index 1c191ab..d564082 100644 --- a/content/public/browser/resource_request_info.h +++ b/content/public/browser/resource_request_info.h @@ -37,14 +37,14 @@ class ResourceRequestInfo { int render_view_id, bool is_async); - // Returns the associated RenderView for a given process. Returns false, if - // there is no associated RenderView. This method does not rely on the + // Returns the associated RenderFrame for a given process. Returns false, if + // there is no associated RenderFrame. This method does not rely on the // request being allocated by the ResourceDispatcherHost, but works for all - // URLRequests that are associated with a RenderView. - CONTENT_EXPORT static bool GetRenderViewForRequest( + // URLRequests that are associated with a RenderFrame. + CONTENT_EXPORT static bool GetRenderFrameForRequest( const net::URLRequest* request, int* render_process_id, - int* render_view_id); + int* render_frame_id); // Returns the associated ResourceContext. virtual ResourceContext* GetContext() const = 0; @@ -100,9 +100,14 @@ class ResourceRequestInfo { virtual bool WasIgnoredByHandler() const = 0; // Returns false if there is NOT an associated render view. + // TODO(jam): remove this. http://crbug.com/304341 virtual bool GetAssociatedRenderView(int* render_process_id, int* render_view_id) const = 0; + // Returns false if there is NOT an associated render frame. + virtual bool GetAssociatedRenderFrame(int* render_process_id, + int* render_frame_id) const = 0; + // Returns true if this is associated with an asynchronous request. virtual bool IsAsync() const = 0; diff --git a/content/public/browser/url_data_source.h b/content/public/browser/url_data_source.h index d93e51e..af395cf 100644 --- a/content/public/browser/url_data_source.h +++ b/content/public/browser/url_data_source.h @@ -49,7 +49,7 @@ class CONTENT_EXPORT URLDataSource { // called either in this callback or asynchronously with the response. virtual void StartDataRequest(const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const GotDataCallback& callback) = 0; // Return the mimetype that should be sent with this response, or empty diff --git a/content/public/common/url_fetcher.h b/content/public/common/url_fetcher.h index 2a8b47d..901e7655 100644 --- a/content/public/common/url_fetcher.h +++ b/content/public/common/url_fetcher.h @@ -16,12 +16,12 @@ class URLFetcher; namespace content { // Mark URLRequests started by the URLFetcher to stem from the given render -// view. -CONTENT_EXPORT void AssociateURLFetcherWithRenderView( +// frame. +CONTENT_EXPORT void AssociateURLFetcherWithRenderFrame( net::URLFetcher* url_fetcher, const GURL& first_party_for_cookies, int render_process_id, - int render_view_id); + int render_frame_id); } // namespace content diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index d7f8472..f0a04f4 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -1128,7 +1128,7 @@ void WebPluginDelegateProxy::FetchURL(unsigned long resource_id, bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id) { + int render_frame_id) { PluginMsg_FetchURL_Params params; params.resource_id = resource_id; params.notify_id = notify_id; @@ -1142,7 +1142,7 @@ void WebPluginDelegateProxy::FetchURL(unsigned long resource_id, params.referrer = referrer; params.notify_redirect = notify_redirects; params.is_plugin_src_load = is_plugin_src_load; - params.render_view_id = render_view_id; + params.render_frame_id = render_frame_id; Send(new PluginMsg_FetchURL(instance_id_, params)); } diff --git a/content/renderer/npapi/webplugin_delegate_proxy.h b/content/renderer/npapi/webplugin_delegate_proxy.h index dfa4842..38c4176 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.h +++ b/content/renderer/npapi/webplugin_delegate_proxy.h @@ -138,7 +138,7 @@ class WebPluginDelegateProxy bool notify_redirects, bool is_plugin_src_load, int origin_pid, - int render_view_id) OVERRIDE; + int render_frame_id) OVERRIDE; gfx::PluginWindowHandle GetPluginWindowHandle(); diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index ed6436f..da30d84 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -324,9 +324,8 @@ void WebPluginImpl::updateGeometry( new_geometry.cutout_rects.push_back(cutout_rects[i]); // Only send DidMovePlugin if the geometry changed in some way. - if (window_ && render_view_.get() && - (first_geometry_update_ || !new_geometry.Equals(geometry_))) { - render_view_->SchedulePluginMove(new_geometry); + if (window_ && (first_geometry_update_ || !new_geometry.Equals(geometry_))) { + render_frame_->GetRenderWidget()->SchedulePluginMove(new_geometry); // We invalidate windowed plugins during the first geometry update to // ensure that they get reparented to the wrapper window in the browser. // This ensures that they become visible and are painted by the OS. This is @@ -385,7 +384,7 @@ void WebPluginImpl::updateFocus(bool focused) { } void WebPluginImpl::updateVisibility(bool visible) { - if (!window_ || !render_view_.get()) + if (!window_) return; WebPluginGeometry move; @@ -395,7 +394,7 @@ void WebPluginImpl::updateVisibility(bool visible) { move.rects_valid = false; move.visible = visible; - render_view_->SchedulePluginMove(move); + render_frame_->GetRenderWidget()->SchedulePluginMove(move); } bool WebPluginImpl::acceptsInputEvents() { @@ -534,8 +533,8 @@ void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { #if defined(USE_X11) // Tell the view delegate that the plugin window was created, so that it // can create necessary container widgets. - render_view_->Send(new ViewHostMsg_CreatePluginContainer( - render_view_->routing_id(), window)); + render_frame_->Send(new ViewHostMsg_CreatePluginContainer( + render_frame_->GetRenderWidget()->routing_id(), window)); #endif // USE_X11 #endif // OS_MACOSX @@ -555,10 +554,10 @@ void WebPluginImpl::WillDestroyWindow(gfx::PluginWindowHandle window) { window_ = gfx::kNullPluginWindow; if (render_view_.get()) { #if defined(USE_X11) - render_view_->Send(new ViewHostMsg_DestroyPluginContainer( - render_view_->routing_id(), window)); + render_frame_->Send(new ViewHostMsg_DestroyPluginContainer( + render_frame_->GetRenderWidget()->routing_id(), window)); #endif - render_view_->CleanupWindowInPluginMoves(window); + render_frame_->GetRenderWidget()->CleanupWindowInPluginMoves(window); } } @@ -753,7 +752,7 @@ void WebPluginImpl::SetCookie(const GURL& url, if (!render_view_.get()) return; - WebCookieJar* cookie_jar = render_view_->cookie_jar(); + WebCookieJar* cookie_jar = render_frame_->cookie_jar(); if (!cookie_jar) { DLOG(WARNING) << "No cookie jar!"; return; @@ -768,7 +767,7 @@ std::string WebPluginImpl::GetCookies(const GURL& url, if (!render_view_.get()) return std::string(); - WebCookieJar* cookie_jar = render_view_->cookie_jar(); + WebCookieJar* cookie_jar = render_frame_->cookie_jar(); if (!cookie_jar) { DLOG(WARNING) << "No cookie jar!"; return std::string(); @@ -1220,7 +1219,7 @@ void WebPluginImpl::HandleURLRequestInternal(const char* url, delegate_->FetchURL(resource_id, notify_id, complete_url, first_party_for_cookies, method, buf, len, referrer, notify_redirects, is_plugin_src_load, 0, - render_view_->routing_id()); + render_frame_->GetRoutingID()); } else { WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( resource_id, complete_url, notify_id); diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 3be9c30..39f20fd 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -126,7 +126,8 @@ RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) : render_view_(render_view), routing_id_(routing_id), is_swapped_out_(false), - is_detaching_(false) { + is_detaching_(false), + cookie_jar_(this) { RenderThread::Get()->AddRoute(routing_id_, this); #if defined(ENABLE_PLUGINS) new PepperBrowserConnection(this); @@ -583,7 +584,7 @@ RenderFrameImpl::createWorkerPermissionClientProxy(WebFrame* frame) { } blink::WebCookieJar* RenderFrameImpl::cookieJar(blink::WebFrame* frame) { - return render_view_->cookieJar(frame); + return &cookie_jar_; } blink::WebServiceWorkerProvider* RenderFrameImpl::createServiceWorkerProvider( diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 6ac984c..6a9ac1a 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -14,6 +14,7 @@ #include "base/process/process_handle.h" #include "base/strings/string16.h" #include "content/public/renderer/render_frame.h" +#include "content/renderer/renderer_webcookiejar_impl.h" #include "ipc/ipc_message.h" #include "third_party/WebKit/public/web/WebDataSource.h" #include "third_party/WebKit/public/web/WebFrameClient.h" @@ -59,6 +60,8 @@ class CONTENT_EXPORT RenderFrameImpl // to using RenderFrame instead of RenderView. RenderViewImpl* render_view() { return render_view_; } + RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } + // Returns the RenderWidget associated with this frame. RenderWidget* GetRenderWidget(); @@ -339,6 +342,8 @@ class CONTENT_EXPORT RenderFrameImpl base::string16 pepper_composition_text_; #endif + RendererWebCookieJarImpl cookie_jar_; + // All the registered observers. ObserverList<RenderFrameObserver> observers_; diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 845ef36..0b831cd 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -257,7 +257,6 @@ using blink::WebColor; using blink::WebColorName; using blink::WebConsoleMessage; using blink::WebContextMenuData; -using blink::WebCookieJar; using blink::WebData; using blink::WebDataSource; using blink::WebDocument; @@ -841,7 +840,6 @@ RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) cached_is_main_frame_pinned_to_right_(false), cached_has_main_frame_horizontal_scrollbar_(false), cached_has_main_frame_vertical_scrollbar_(false), - cookie_jar_(this), notification_provider_(NULL), geolocation_dispatcher_(NULL), input_tag_speech_dispatcher_(NULL), @@ -3051,10 +3049,6 @@ blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( #endif // defined(OS_ANDROID) } -WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { - return &cookie_jar_; -} - void RenderViewImpl::didAccessInitialDocument(WebFrame* frame) { // Notify the browser process that it is no longer safe to show the pending // URL of the main frame, since a URL spoof is now possible. diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index d74c89c..e4faa0b 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -40,7 +40,6 @@ #include "content/renderer/render_frame_impl.h" #include "content/renderer/render_widget.h" #include "content/renderer/renderer_date_time_picker.h" -#include "content/renderer/renderer_webcookiejar_impl.h" #include "content/renderer/stats_collection_observer.h" #include "ipc/ipc_platform_file.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" @@ -241,8 +240,6 @@ class CONTENT_EXPORT RenderViewImpl return mouse_lock_dispatcher_; } - RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } - // Lazily initialize this view's BrowserPluginManager and return it. BrowserPluginManager* GetBrowserPluginManager(); @@ -515,7 +512,6 @@ class CONTENT_EXPORT RenderViewImpl blink::WebFrame* frame, const blink::WebURL& url, blink::WebMediaPlayerClient* client); - virtual blink::WebCookieJar* cookieJar(blink::WebFrame* frame); virtual void didAccessInitialDocument(blink::WebFrame* frame); virtual void didDisownOpener(blink::WebFrame* frame); virtual void frameDetached(blink::WebFrame* frame); @@ -1356,8 +1352,6 @@ class CONTENT_EXPORT RenderViewImpl scoped_ptr<RenderFrameImpl> main_render_frame_; - RendererWebCookieJarImpl cookie_jar_; - // The next group of objects all implement RenderViewObserver, so are deleted // along with the RenderView automatically. This is why we just store // weak references. diff --git a/content/renderer/renderer_webcookiejar_impl.cc b/content/renderer/renderer_webcookiejar_impl.cc index c74f16a..4018ac0 100644 --- a/content/renderer/renderer_webcookiejar_impl.cc +++ b/content/renderer/renderer_webcookiejar_impl.cc @@ -23,14 +23,14 @@ void RendererWebCookieJarImpl::setCookie( const WebString& value) { std::string value_utf8 = UTF16ToUTF8(value); sender_->Send(new ViewHostMsg_SetCookie( - MSG_ROUTING_NONE, url, first_party_for_cookies, value_utf8)); + sender_->GetRoutingID(), url, first_party_for_cookies, value_utf8)); } WebString RendererWebCookieJarImpl::cookies( const WebURL& url, const WebURL& first_party_for_cookies) { std::string value_utf8; sender_->Send(new ViewHostMsg_GetCookies( - MSG_ROUTING_NONE, url, first_party_for_cookies, &value_utf8)); + sender_->GetRoutingID(), url, first_party_for_cookies, &value_utf8)); return WebString::fromUTF8(value_utf8); } @@ -43,7 +43,6 @@ void RendererWebCookieJarImpl::rawCookies( const WebURL& url, const WebURL& first_party_for_cookies, WebVector<WebCookie>& raw_cookies) { std::vector<CookieData> cookies; - // NOTE: This may pump events (see RenderThread::Send). sender_->Send(new ViewHostMsg_GetRawCookies( url, first_party_for_cookies, &cookies)); @@ -71,7 +70,6 @@ void RendererWebCookieJarImpl::deleteCookie( bool RendererWebCookieJarImpl::cookiesEnabled( const WebURL& url, const WebURL& first_party_for_cookies) { bool cookies_enabled; - // NOTE: This may pump events (see RenderThread::Send). sender_->Send(new ViewHostMsg_CookiesEnabled( url, first_party_for_cookies, &cookies_enabled)); return cookies_enabled; diff --git a/content/renderer/renderer_webcookiejar_impl.h b/content/renderer/renderer_webcookiejar_impl.h index a6451af..ad911f2 100644 --- a/content/renderer/renderer_webcookiejar_impl.h +++ b/content/renderer/renderer_webcookiejar_impl.h @@ -7,14 +7,13 @@ // TODO(darin): WebCookieJar.h is missing a WebString.h include! #include "third_party/WebKit/public/platform/WebCookieJar.h" -#include "third_party/WebKit/public/platform/WebString.h" namespace content { -class RenderViewImpl; +class RenderFrameImpl; class RendererWebCookieJarImpl : public blink::WebCookieJar { public: - explicit RendererWebCookieJarImpl(RenderViewImpl* sender) + explicit RendererWebCookieJarImpl(RenderFrameImpl* sender) : sender_(sender) { } virtual ~RendererWebCookieJarImpl() {} @@ -36,7 +35,7 @@ class RendererWebCookieJarImpl : public blink::WebCookieJar { virtual bool cookiesEnabled( const blink::WebURL& url, const blink::WebURL& first_party_for_cookies); - RenderViewImpl* sender_; + RenderFrameImpl* sender_; }; } // namespace content |