diff options
94 files changed, 356 insertions, 300 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 2e614ee..e19d63d 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc @@ -258,13 +258,13 @@ bool AwContentBrowserClient::AllowGetCookie(const GURL& url, const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id) { + int render_frame_id) { return AwCookieAccessPolicy::GetInstance()->AllowGetCookie(url, first_party, cookie_list, context, render_process_id, - render_view_id); + render_frame_id); } bool AwContentBrowserClient::AllowSetCookie(const GURL& url, @@ -272,14 +272,14 @@ bool AwContentBrowserClient::AllowSetCookie(const GURL& url, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) { return AwCookieAccessPolicy::GetInstance()->AllowSetCookie(url, first_party, cookie_line, context, render_process_id, - render_view_id, + render_frame_id, options); } diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index 5d5233d..ac15cc7 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h @@ -66,13 +66,13 @@ class AwContentBrowserClient : public content::ContentBrowserClient { const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id) OVERRIDE; + int render_frame_id) OVERRIDE; virtual bool AllowSetCookie(const GURL& url, const GURL& first_party, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) OVERRIDE; virtual bool AllowWorkerDatabase( const GURL& url, diff --git a/android_webview/browser/aw_contents_io_thread_client.h b/android_webview/browser/aw_contents_io_thread_client.h index aedfba2..11c17f7 100644 --- a/android_webview/browser/aw_contents_io_thread_client.h +++ b/android_webview/browser/aw_contents_io_thread_client.h @@ -56,11 +56,11 @@ class AwContentsIoThreadClient { virtual CacheMode GetCacheMode() const = 0; // This will attempt to fetch the AwContentsIoThreadClient for the given - // |render_process_id|, |render_view_id| pair. + // |render_process_id|, |render_frame_id| pair. // This method can be called from any thread. // An empty scoped_ptr is a valid return value. static scoped_ptr<AwContentsIoThreadClient> FromID(int render_process_id, - int render_view_id); + int render_frame_id); // This method is called on the IO thread only. virtual scoped_ptr<InterceptedRequestData> ShouldInterceptRequest( diff --git a/android_webview/browser/aw_cookie_access_policy.cc b/android_webview/browser/aw_cookie_access_policy.cc index 550ab35..15158b9 100644 --- a/android_webview/browser/aw_cookie_access_policy.cc +++ b/android_webview/browser/aw_cookie_access_policy.cc @@ -54,7 +54,7 @@ bool AwCookieAccessPolicy::AllowGetCookie(const GURL& url, const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id) { + int render_frame_id) { return GetGlobalAllowAccess(); } @@ -63,7 +63,7 @@ bool AwCookieAccessPolicy::AllowSetCookie(const GURL& url, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) { return GetGlobalAllowAccess(); } diff --git a/android_webview/browser/aw_cookie_access_policy.h b/android_webview/browser/aw_cookie_access_policy.h index b25e4f6..7014521 100644 --- a/android_webview/browser/aw_cookie_access_policy.h +++ b/android_webview/browser/aw_cookie_access_policy.h @@ -48,13 +48,13 @@ class AwCookieAccessPolicy { const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id); + int render_frame_id); bool AllowSetCookie(const GURL& url, const GURL& first_party, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options); private: diff --git a/android_webview/browser/aw_login_delegate.cc b/android_webview/browser/aw_login_delegate.cc index 84ef2cb2..5656b91 100644 --- a/android_webview/browser/aw_login_delegate.cc +++ b/android_webview/browser/aw_login_delegate.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/supports_user_data.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_view_host.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_request_info.h" #include "content/public/browser/web_contents.h" @@ -18,7 +18,7 @@ using namespace base::android; using content::BrowserThread; -using content::RenderViewHost; +using content::RenderFrameHost; using content::ResourceDispatcherHost; using content::ResourceRequestInfo; using content::WebContents; @@ -41,9 +41,9 @@ AwLoginDelegate::AwLoginDelegate(net::AuthChallengeInfo* auth_info, : auth_info_(auth_info), request_(request), render_process_id_(0), - render_view_id_(0) { - ResourceRequestInfo::GetRenderViewForRequest( - request, &render_process_id_, &render_view_id_); + render_frame_id_(0) { + ResourceRequestInfo::GetRenderFrameForRequest( + request, &render_process_id_, &render_frame_id_); UrlRequestAuthAttemptsData* count = static_cast<UrlRequestAuthAttemptsData*>( @@ -87,15 +87,15 @@ void AwLoginDelegate::HandleHttpAuthRequestOnUIThread( aw_http_auth_handler_.reset(AwHttpAuthHandlerBase::Create( this, auth_info_.get(), first_auth_attempt)); - RenderViewHost* render_view_host = RenderViewHost::FromID( - render_process_id_, render_view_id_); - if (!render_view_host) { + RenderFrameHost* render_frame_host = RenderFrameHost::FromID( + render_process_id_, render_frame_id_); + if (!render_frame_host) { Cancel(); return; } - WebContents* web_contents = WebContents::FromRenderViewHost( - render_view_host); + WebContents* web_contents = WebContents::FromRenderFrameHost( + render_frame_host); if (!aw_http_auth_handler_->HandleOnUIThread(web_contents)) { Cancel(); return; diff --git a/android_webview/browser/aw_login_delegate.h b/android_webview/browser/aw_login_delegate.h index f0f8769..7d13400 100644 --- a/android_webview/browser/aw_login_delegate.h +++ b/android_webview/browser/aw_login_delegate.h @@ -43,7 +43,7 @@ class AwLoginDelegate : scoped_refptr<net::AuthChallengeInfo> auth_info_; net::URLRequest* request_; int render_process_id_; - int render_view_id_; + int render_frame_id_; }; } // namespace android_webview diff --git a/android_webview/browser/aw_request_interceptor.cc b/android_webview/browser/aw_request_interceptor.cc index 72673d2..e61d04b 100644 --- a/android_webview/browser/aw_request_interceptor.cc +++ b/android_webview/browser/aw_request_interceptor.cc @@ -39,13 +39,13 @@ AwRequestInterceptor::QueryForInterceptedRequestData( const GURL& location, net::URLRequest* request) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - int render_process_id, render_view_id; - if (!ResourceRequestInfo::GetRenderViewForRequest( - request, &render_process_id, &render_view_id)) + int render_process_id, render_frame_id; + if (!ResourceRequestInfo::GetRenderFrameForRequest( + request, &render_process_id, &render_frame_id)) return scoped_ptr<InterceptedRequestData>(); scoped_ptr<AwContentsIoThreadClient> io_thread_client = - AwContentsIoThreadClient::FromID(render_process_id, render_view_id); + AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); if (!io_thread_client.get()) return scoped_ptr<InterceptedRequestData>(); diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index 5042dcd..195d79a 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc @@ -53,13 +53,13 @@ namespace android_webview { // Calls through the IoThreadClient to check the embedders settings to determine // if the request should be cancelled. There may not always be an IoThreadClient -// available for the |child_id|, |route_id| pair (in the case of newly created -// pop up windows, for example) and in that case the request and the client -// callbacks will be deferred the request until a client is ready. +// available for the |render_process_id|, |render_frame_id| pair (in the case of +// newly created pop up windows, for example) and in that case the request and +// the client callbacks will be deferred the request until a client is ready. class IoThreadClientThrottle : public content::ResourceThrottle { public: - IoThreadClientThrottle(int child_id, - int route_id, + IoThreadClientThrottle(int render_process_id, + int render_frame_id, net::URLRequest* request); virtual ~IoThreadClientThrottle(); @@ -68,23 +68,24 @@ class IoThreadClientThrottle : public content::ResourceThrottle { virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; virtual const char* GetNameForLogging() const OVERRIDE; - void OnIoThreadClientReady(int new_child_id, int new_route_id); + void OnIoThreadClientReady(int new_render_process_id, + int new_render_frame_id); bool MaybeBlockRequest(); bool ShouldBlockRequest(); - int get_child_id() const { return child_id_; } - int get_route_id() const { return route_id_; } + int render_process_id() const { return render_process_id_; } + int render_frame_id() const { return render_frame_id_; } -private: - int child_id_; - int route_id_; + private: + int render_process_id_; + int render_frame_id_; net::URLRequest* request_; }; -IoThreadClientThrottle::IoThreadClientThrottle(int child_id, - int route_id, +IoThreadClientThrottle::IoThreadClientThrottle(int render_process_id, + int render_frame_id, net::URLRequest* request) - : child_id_(child_id), - route_id_(route_id), + : render_process_id_(render_process_id), + render_frame_id_(render_frame_id), request_(request) { } IoThreadClientThrottle::~IoThreadClientThrottle() { @@ -100,22 +101,22 @@ const char* IoThreadClientThrottle::GetNameForLogging() const { void IoThreadClientThrottle::WillStartRequest(bool* defer) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // TODO(sgurun): This block can be removed when crbug.com/277937 is fixed. - if (route_id_ < 1) { + if (render_frame_id_ < 1) { // OPTIONS is used for preflighted requests which are generated internally. DCHECK_EQ("OPTIONS", request_->method()); return; } - DCHECK(child_id_); + DCHECK(render_process_id_); *defer = false; // Defer all requests of a pop up that is still not associated with Java // client so that the client will get a chance to override requests. scoped_ptr<AwContentsIoThreadClient> io_client = - AwContentsIoThreadClient::FromID(child_id_, route_id_); + AwContentsIoThreadClient::FromID(render_process_id_, render_frame_id_); if (io_client && io_client->PendingAssociation()) { *defer = true; AwResourceDispatcherHostDelegate::AddPendingThrottle( - child_id_, route_id_, this); + render_process_id_, render_frame_id_, this); } else { MaybeBlockRequest(); } @@ -126,8 +127,8 @@ void IoThreadClientThrottle::WillRedirectRequest(const GURL& new_url, WillStartRequest(defer); } -void IoThreadClientThrottle::OnIoThreadClientReady(int new_child_id, - int new_route_id) { +void IoThreadClientThrottle::OnIoThreadClientReady(int new_render_process_id, + int new_render_frame_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (!MaybeBlockRequest()) { @@ -145,7 +146,7 @@ bool IoThreadClientThrottle::MaybeBlockRequest() { bool IoThreadClientThrottle::ShouldBlockRequest() { scoped_ptr<AwContentsIoThreadClient> io_client = - AwContentsIoThreadClient::FromID(child_id_, route_id_); + AwContentsIoThreadClient::FromID(render_process_id_, render_frame_id_); if (!io_client) return false; @@ -215,13 +216,16 @@ void AwResourceDispatcherHostDelegate::RequestBeginning( AddExtraHeadersIfNeeded(request, resource_context); + const content::ResourceRequestInfo* request_info = + content::ResourceRequestInfo::ForRequest(request); + // We always push the throttles here. Checking the existence of io_client // is racy when a popup window is created. That is because RequestBeginning // is called whether or not requests are blocked via BlockRequestForRoute() // however io_client may or may not be ready at the time depending on whether // webcontents is created. throttles->push_back(new IoThreadClientThrottle( - child_id, route_id, request)); + child_id, request_info->GetRenderFrameID(), request)); // We allow intercepting only navigations within main frames. This // is used to post onPageStarted. We handle shouldOverrideUrlLoading @@ -268,8 +272,12 @@ void AwResourceDispatcherHostDelegate::DownloadStarting( request->Cancel(); + const content::ResourceRequestInfo* request_info = + content::ResourceRequestInfo::ForRequest(request); + scoped_ptr<AwContentsIoThreadClient> io_client = - AwContentsIoThreadClient::FromID(child_id, route_id); + AwContentsIoThreadClient::FromID( + child_id, request_info->GetRenderFrameID()); // POST request cannot be repeated in general, so prevent client from // retrying the same request, even if it is with a GET. @@ -337,7 +345,7 @@ void AwResourceDispatcherHostDelegate::OnResponseStarted( request, auto_login_parser::ALLOW_ANY_REALM, &header_data)) { scoped_ptr<AwContentsIoThreadClient> io_client = AwContentsIoThreadClient::FromID(request_info->GetChildID(), - request_info->GetRouteID()); + request_info->GetRenderFrameID()); if (io_client) { io_client->NewLoginRequest( header_data.realm, header_data.account, header_data.args); @@ -350,7 +358,8 @@ void AwResourceDispatcherHostDelegate::RemovePendingThrottleOnIoThread( IoThreadClientThrottle* throttle) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); PendingThrottleMap::iterator it = pending_throttles_.find( - ChildRouteIDPair(throttle->get_child_id(), throttle->get_route_id())); + FrameRouteIDPair(throttle->render_process_id(), + throttle->render_frame_id())); if (it != pending_throttles_.end()) { pending_throttles_.erase(it); } @@ -358,49 +367,50 @@ void AwResourceDispatcherHostDelegate::RemovePendingThrottleOnIoThread( // static void AwResourceDispatcherHostDelegate::OnIoThreadClientReady( - int new_child_id, - int new_route_id) { + int new_render_process_id, + int new_render_frame_id) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &AwResourceDispatcherHostDelegate::OnIoThreadClientReadyInternal, base::Unretained( g_webview_resource_dispatcher_host_delegate.Pointer()), - new_child_id, new_route_id)); + new_render_process_id, new_render_frame_id)); } // static void AwResourceDispatcherHostDelegate::AddPendingThrottle( - int child_id, - int route_id, + int render_process_id, + int render_frame_id, IoThreadClientThrottle* pending_throttle) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &AwResourceDispatcherHostDelegate::AddPendingThrottleOnIoThread, base::Unretained( g_webview_resource_dispatcher_host_delegate.Pointer()), - child_id, route_id, pending_throttle)); + render_process_id, render_frame_id, pending_throttle)); } void AwResourceDispatcherHostDelegate::AddPendingThrottleOnIoThread( - int child_id, - int route_id, + int render_process_id, + int render_frame_id_id, IoThreadClientThrottle* pending_throttle) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); pending_throttles_.insert( - std::pair<ChildRouteIDPair, IoThreadClientThrottle*>( - ChildRouteIDPair(child_id, route_id), pending_throttle)); + std::pair<FrameRouteIDPair, IoThreadClientThrottle*>( + FrameRouteIDPair(render_process_id, render_frame_id_id), + pending_throttle)); } void AwResourceDispatcherHostDelegate::OnIoThreadClientReadyInternal( - int new_child_id, - int new_route_id) { + int new_render_process_id, + int new_render_frame_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); PendingThrottleMap::iterator it = pending_throttles_.find( - ChildRouteIDPair(new_child_id, new_route_id)); + FrameRouteIDPair(new_render_process_id, new_render_frame_id)); if (it != pending_throttles_.end()) { IoThreadClientThrottle* throttle = it->second; - throttle->OnIoThreadClientReady(new_child_id, new_route_id); + throttle->OnIoThreadClientReady(new_render_process_id, new_render_frame_id); pending_throttles_.erase(it); } } diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h index 1ae3333..d669ff7 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h @@ -72,9 +72,10 @@ class AwResourceDispatcherHostDelegate void RemovePendingThrottleOnIoThread(IoThreadClientThrottle* throttle); - static void OnIoThreadClientReady(int new_child_id, int new_route_id); - static void AddPendingThrottle(int child_id, - int route_id, + static void OnIoThreadClientReady(int new_render_process_id, + int new_render_frame_id); + static void AddPendingThrottle(int render_process_id, + int render_frame_id, IoThreadClientThrottle* pending_throttle); private: @@ -84,15 +85,17 @@ class AwResourceDispatcherHostDelegate virtual ~AwResourceDispatcherHostDelegate(); // These methods must be called on IO thread. - void OnIoThreadClientReadyInternal(int child_id, int route_id); - void AddPendingThrottleOnIoThread(int child_id, - int route_id, + void OnIoThreadClientReadyInternal(int new_render_process_id, + int new_render_frame_id); + void AddPendingThrottleOnIoThread(int render_process_id, + int render_frame_id, IoThreadClientThrottle* pending_throttle); void AddExtraHeadersIfNeeded(net::URLRequest* request, content::ResourceContext* resource_context); - typedef std::pair<int, int> ChildRouteIDPair; - typedef std::map<ChildRouteIDPair, IoThreadClientThrottle*> + // Pair of render_process_id and render_frame_id. + typedef std::pair<int, int> FrameRouteIDPair; + typedef std::map<FrameRouteIDPair, IoThreadClientThrottle*> PendingThrottleMap; // Only accessed on the IO thread. diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 3df421f..9e10dd1 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -45,6 +45,7 @@ #include "content/public/browser/cert_store.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" @@ -159,6 +160,13 @@ GetRendererPreferencesSubpixelRenderingEnum( } } +void OnIoThreadClientReady(content::RenderFrameHost* rfh) { + int render_process_id = rfh->GetProcess()->GetID(); + int render_frame_id = rfh->GetRoutingID(); + AwResourceDispatcherHostDelegate::OnIoThreadClientReady( + render_process_id, render_frame_id); +} + } // namespace // static @@ -229,9 +237,7 @@ void AwContents::SetJavaPeers(JNIEnv* env, env, intercept_navigation_delegate))); // Finally, having setup the associations, release any deferred requests - int child_id = web_contents_->GetRenderProcessHost()->GetID(); - int route_id = web_contents_->GetRoutingID(); - AwResourceDispatcherHostDelegate::OnIoThreadClientReady(child_id, route_id); + web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady)); } void AwContents::SetSaveFormData(bool enabled) { diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc index 6e24d9a..ccdbbff 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.cc +++ b/android_webview/native/aw_contents_io_thread_client_impl.cc @@ -15,6 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_request_info.h" @@ -30,7 +31,7 @@ using base::android::JavaRef; using base::android::ScopedJavaLocalRef; using base::LazyInstance; using content::BrowserThread; -using content::RenderViewHost; +using content::RenderFrameHost; using content::WebContents; using std::map; using std::pair; @@ -49,56 +50,56 @@ struct IoThreadClientData { IoThreadClientData::IoThreadClientData() : pending_association(false) {} typedef map<pair<int, int>, IoThreadClientData> - RenderViewHostToIoThreadClientType; + RenderFrameHostToIoThreadClientType; -static pair<int, int> GetRenderViewHostIdPair(RenderViewHost* rvh) { - return pair<int, int>(rvh->GetProcess()->GetID(), rvh->GetRoutingID()); +static pair<int, int> GetRenderFrameHostIdPair(RenderFrameHost* rfh) { + return pair<int, int>(rfh->GetProcess()->GetID(), rfh->GetRoutingID()); } -// RvhToIoThreadClientMap ----------------------------------------------------- -class RvhToIoThreadClientMap { +// RfhToIoThreadClientMap ----------------------------------------------------- +class RfhToIoThreadClientMap { public: - static RvhToIoThreadClientMap* GetInstance(); - void Set(pair<int, int> rvh_id, const IoThreadClientData& client); - bool Get(pair<int, int> rvh_id, IoThreadClientData* client); - void Erase(pair<int, int> rvh_id); + static RfhToIoThreadClientMap* GetInstance(); + void Set(pair<int, int> rfh_id, const IoThreadClientData& client); + bool Get(pair<int, int> rfh_id, IoThreadClientData* client); + void Erase(pair<int, int> rfh_id); private: - static LazyInstance<RvhToIoThreadClientMap> g_instance_; + static LazyInstance<RfhToIoThreadClientMap> g_instance_; base::Lock map_lock_; - RenderViewHostToIoThreadClientType rvh_to_io_thread_client_; + RenderFrameHostToIoThreadClientType rfh_to_io_thread_client_; }; // static -LazyInstance<RvhToIoThreadClientMap> RvhToIoThreadClientMap::g_instance_ = +LazyInstance<RfhToIoThreadClientMap> RfhToIoThreadClientMap::g_instance_ = LAZY_INSTANCE_INITIALIZER; // static -RvhToIoThreadClientMap* RvhToIoThreadClientMap::GetInstance() { +RfhToIoThreadClientMap* RfhToIoThreadClientMap::GetInstance() { return g_instance_.Pointer(); } -void RvhToIoThreadClientMap::Set(pair<int, int> rvh_id, +void RfhToIoThreadClientMap::Set(pair<int, int> rfh_id, const IoThreadClientData& client) { base::AutoLock lock(map_lock_); - rvh_to_io_thread_client_[rvh_id] = client; + rfh_to_io_thread_client_[rfh_id] = client; } -bool RvhToIoThreadClientMap::Get( - pair<int, int> rvh_id, IoThreadClientData* client) { +bool RfhToIoThreadClientMap::Get( + pair<int, int> rfh_id, IoThreadClientData* client) { base::AutoLock lock(map_lock_); - RenderViewHostToIoThreadClientType::iterator iterator = - rvh_to_io_thread_client_.find(rvh_id); - if (iterator == rvh_to_io_thread_client_.end()) + RenderFrameHostToIoThreadClientType::iterator iterator = + rfh_to_io_thread_client_.find(rfh_id); + if (iterator == rfh_to_io_thread_client_.end()) return false; *client = iterator->second; return true; } -void RvhToIoThreadClientMap::Erase(pair<int, int> rvh_id) { +void RfhToIoThreadClientMap::Erase(pair<int, int> rfh_id) { base::AutoLock lock(map_lock_); - rvh_to_io_thread_client_.erase(rvh_id); + rfh_to_io_thread_client_.erase(rfh_id); } // ClientMapEntryUpdater ------------------------------------------------------ @@ -108,8 +109,8 @@ class ClientMapEntryUpdater : public content::WebContentsObserver { ClientMapEntryUpdater(JNIEnv* env, WebContents* web_contents, jobject jdelegate); - virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; - virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; + virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; private: @@ -124,20 +125,20 @@ ClientMapEntryUpdater::ClientMapEntryUpdater(JNIEnv* env, DCHECK(web_contents); DCHECK(jdelegate); - if (web_contents->GetRenderViewHost()) - RenderViewCreated(web_contents->GetRenderViewHost()); + if (web_contents->GetMainFrame()) + RenderFrameCreated(web_contents->GetMainFrame()); } -void ClientMapEntryUpdater::RenderViewCreated(RenderViewHost* rvh) { +void ClientMapEntryUpdater::RenderFrameCreated(RenderFrameHost* rfh) { IoThreadClientData client_data; client_data.io_thread_client = jdelegate_; client_data.pending_association = false; - RvhToIoThreadClientMap::GetInstance()->Set( - GetRenderViewHostIdPair(rvh), client_data); + RfhToIoThreadClientMap::GetInstance()->Set( + GetRenderFrameHostIdPair(rfh), client_data); } -void ClientMapEntryUpdater::RenderViewDeleted(RenderViewHost* rvh) { - RvhToIoThreadClientMap::GetInstance()->Erase(GetRenderViewHostIdPair(rvh)); +void ClientMapEntryUpdater::RenderFrameDeleted(RenderFrameHost* rfh) { + RfhToIoThreadClientMap::GetInstance()->Erase(GetRenderFrameHostIdPair(rfh)); } void ClientMapEntryUpdater::WebContentsDestroyed(WebContents* web_contents) { @@ -150,10 +151,10 @@ void ClientMapEntryUpdater::WebContentsDestroyed(WebContents* web_contents) { // static scoped_ptr<AwContentsIoThreadClient> -AwContentsIoThreadClient::FromID(int render_process_id, int render_view_id) { - pair<int, int> rvh_id(render_process_id, render_view_id); +AwContentsIoThreadClient::FromID(int render_process_id, int render_frame_id) { + pair<int, int> rfh_id(render_process_id, render_frame_id); IoThreadClientData client_data; - if (!RvhToIoThreadClientMap::GetInstance()->Get(rvh_id, &client_data)) + if (!RfhToIoThreadClientMap::GetInstance()->Get(rfh_id, &client_data)) return scoped_ptr<AwContentsIoThreadClient>(); JNIEnv* env = AttachCurrentThread(); @@ -169,8 +170,8 @@ void AwContentsIoThreadClientImpl::RegisterPendingContents( WebContents* web_contents) { IoThreadClientData client_data; client_data.pending_association = true; - RvhToIoThreadClientMap::GetInstance()->Set( - GetRenderViewHostIdPair(web_contents->GetRenderViewHost()), client_data); + RfhToIoThreadClientMap::GetInstance()->Set( + GetRenderFrameHostIdPair(web_contents->GetMainFrame()), client_data); } // static diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index cfd1f7d..5d84306 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1619,7 +1619,7 @@ bool ChromeContentBrowserClient::AllowGetCookie( const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id) { + int render_frame_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); bool allow = io_data->GetCookieSettings()-> @@ -1628,7 +1628,7 @@ bool ChromeContentBrowserClient::AllowGetCookie( BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TabSpecificContentSettings::CookiesRead, render_process_id, - render_view_id, url, first_party, cookie_list, !allow)); + render_frame_id, url, first_party, cookie_list, !allow)); return allow; } @@ -1638,7 +1638,7 @@ bool ChromeContentBrowserClient::AllowSetCookie( const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); @@ -1648,7 +1648,7 @@ bool ChromeContentBrowserClient::AllowSetCookie( BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TabSpecificContentSettings::CookieChanged, render_process_id, - render_view_id, url, first_party, cookie_line, *options, + render_frame_id, url, first_party, cookie_line, *options, !allow)); return allow; } diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 2fd5e07..6387bf6 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -123,13 +123,13 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_view_id) OVERRIDE; + int render_frame_id) OVERRIDE; virtual bool AllowSetCookie(const GURL& url, const GURL& first_party, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, - int render_view_id, + int render_frame_id, net::CookieOptions* options) OVERRIDE; virtual bool AllowSaveLocalState(content::ResourceContext* context) OVERRIDE; virtual bool AllowWorkerDatabase( diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index f605595..a5b74ac 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -116,13 +116,14 @@ TabSpecificContentSettings* TabSpecificContentSettings::GetForFrame( // static void TabSpecificContentSettings::CookiesRead(int render_process_id, - int render_view_id, + int render_frame_id, const GURL& url, const GURL& frame_url, const net::CookieList& cookie_list, bool blocked_by_policy) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); + TabSpecificContentSettings* settings = + GetForFrame(render_process_id, render_frame_id); if (settings) { settings->OnCookiesRead(url, frame_url, cookie_list, blocked_by_policy); @@ -132,14 +133,15 @@ void TabSpecificContentSettings::CookiesRead(int render_process_id, // static void TabSpecificContentSettings::CookieChanged( int render_process_id, - int render_view_id, + int render_frame_id, const GURL& url, const GURL& frame_url, const std::string& cookie_line, const net::CookieOptions& options, bool blocked_by_policy) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); + TabSpecificContentSettings* settings = + GetForFrame(render_process_id, render_frame_id); if (settings) settings->OnCookieChanged(url, frame_url, cookie_line, options, blocked_by_policy); diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h index 9543016..358075b 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.h +++ b/chrome/browser/content_settings/tab_specific_content_settings.h @@ -96,7 +96,7 @@ class TabSpecificContentSettings // reading cookies was blocked due to the user's content settings. In that // case, this function should invoke OnContentBlocked. static void CookiesRead(int render_process_id, - int render_view_id, + int render_frame_id, const GURL& url, const GURL& first_party_url, const net::CookieList& cookie_list, @@ -107,7 +107,7 @@ class TabSpecificContentSettings // user's content settings. In that case, this function should invoke // OnContentBlocked. static void CookieChanged(int render_process_id, - int render_view_id, + int render_frame_id, const GURL& url, const GURL& first_party_url, const std::string& cookie_line, diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index ba5eae6..57e15d6 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -650,13 +650,13 @@ bool ChromeNetworkDelegate::OnCanGetCookies( request.url(), request.first_party_for_cookies()); int render_process_id = -1; - int render_view_id = -1; - if (content::ResourceRequestInfo::GetRenderViewForRequest( - &request, &render_process_id, &render_view_id)) { + int render_frame_id = -1; + if (content::ResourceRequestInfo::GetRenderFrameForRequest( + &request, &render_process_id, &render_frame_id)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TabSpecificContentSettings::CookiesRead, - render_process_id, render_view_id, + render_process_id, render_frame_id, request.url(), request.first_party_for_cookies(), cookie_list, !allow)); } @@ -675,13 +675,13 @@ bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, request.url(), request.first_party_for_cookies()); int render_process_id = -1; - int render_view_id = -1; - if (content::ResourceRequestInfo::GetRenderViewForRequest( - &request, &render_process_id, &render_view_id)) { + int render_frame_id = -1; + if (content::ResourceRequestInfo::GetRenderFrameForRequest( + &request, &render_process_id, &render_frame_id)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TabSpecificContentSettings::CookieChanged, - render_process_id, render_view_id, + render_process_id, render_frame_id, request.url(), request.first_party_for_cookies(), cookie_line, *options, !allow)); } diff --git a/chrome/browser/search/iframe_source_unittest.cc b/chrome/browser/search/iframe_source_unittest.cc index 7df025d..cf40af7 100644 --- a/chrome/browser/search/iframe_source_unittest.cc +++ b/chrome/browser/search/iframe_source_unittest.cc @@ -46,7 +46,7 @@ class TestIframeSource : public IframeSource { 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 { } diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index 6277c4c..f53e1b8 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -134,7 +134,7 @@ std::string LocalNtpSource::GetSource() const { void LocalNtpSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { const std::string stripped_path = StripParameters(path); if (stripped_path == kConfigDataFilename) { diff --git a/chrome/browser/search/local_ntp_source.h b/chrome/browser/search/local_ntp_source.h index 410a2d1..66fd76c 100644 --- a/chrome/browser/search/local_ntp_source.h +++ b/chrome/browser/search/local_ntp_source.h @@ -25,7 +25,7 @@ class LocalNtpSource : 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& path) const OVERRIDE; virtual bool ShouldServiceRequest( diff --git a/chrome/browser/search/most_visited_iframe_source.cc b/chrome/browser/search/most_visited_iframe_source.cc index 7ba9252..94481f5 100644 --- a/chrome/browser/search/most_visited_iframe_source.cc +++ b/chrome/browser/search/most_visited_iframe_source.cc @@ -45,7 +45,7 @@ std::string MostVisitedIframeSource::GetSource() const { void MostVisitedIframeSource::StartDataRequest( const std::string& path_and_query, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { GURL url(chrome::kChromeSearchMostVisitedUrl + path_and_query); std::string path(url.path()); diff --git a/chrome/browser/search/most_visited_iframe_source.h b/chrome/browser/search/most_visited_iframe_source.h index c05d0d8..fad9823 100644 --- a/chrome/browser/search/most_visited_iframe_source.h +++ b/chrome/browser/search/most_visited_iframe_source.h @@ -26,7 +26,7 @@ class MostVisitedIframeSource : public IframeSource { virtual void StartDataRequest( const std::string& path_and_query, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) OVERRIDE; protected: diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc index 03d3705..0d86d682 100644 --- a/chrome/browser/search_engines/template_url_fetcher.cc +++ b/chrome/browser/search_engines/template_url_fetcher.cc @@ -14,8 +14,8 @@ #include "chrome/browser/search_engines/template_url_parser.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" -#include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_fetcher.h" #include "net/base/load_flags.h" @@ -98,11 +98,11 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( url_fetcher_->SetRequestContext(fetcher->profile()->GetRequestContext()); // Can be NULL during tests. if (web_contents) { - content::AssociateURLFetcherWithRenderView( + content::AssociateURLFetcherWithRenderFrame( url_fetcher_.get(), web_contents->GetURL(), web_contents->GetRenderProcessHost()->GetID(), - web_contents->GetRenderViewHost()->GetRoutingID()); + web_contents->GetMainFrame()->GetRoutingID()); } url_fetcher_->Start(); diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 05879c7..66c71ea 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -996,7 +996,7 @@ std::string AboutUIHTMLSource::GetSource() const { void AboutUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { std::string response; // Add your data source here, in alphabetical order. diff --git a/chrome/browser/ui/webui/about_ui.h b/chrome/browser/ui/webui/about_ui.h index d2bcda8..b98695e 100644 --- a/chrome/browser/ui/webui/about_ui.h +++ b/chrome/browser/ui/webui/about_ui.h @@ -26,7 +26,7 @@ class AboutUIHTMLSource : 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& path) const OVERRIDE; virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE; diff --git a/chrome/browser/ui/webui/app_launcher_page_ui.cc b/chrome/browser/ui/webui/app_launcher_page_ui.cc index d318420..1de9db3 100644 --- a/chrome/browser/ui/webui/app_launcher_page_ui.cc +++ b/chrome/browser/ui/webui/app_launcher_page_ui.cc @@ -92,7 +92,7 @@ std::string AppLauncherPageUI::HTMLSource::GetSource() const { void AppLauncherPageUI::HTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/ui/webui/app_launcher_page_ui.h b/chrome/browser/ui/webui/app_launcher_page_ui.h index a867721..b21b363 100644 --- a/chrome/browser/ui/webui/app_launcher_page_ui.h +++ b/chrome/browser/ui/webui/app_launcher_page_ui.h @@ -35,7 +35,7 @@ class AppLauncherPageUI : public content::WebUIController { 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; virtual bool ShouldReplaceExistingSource() const OVERRIDE; diff --git a/chrome/browser/ui/webui/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks_ui.cc index ca8ac4b..1259adf 100644 --- a/chrome/browser/ui/webui/bookmarks_ui.cc +++ b/chrome/browser/ui/webui/bookmarks_ui.cc @@ -29,7 +29,7 @@ std::string BookmarksUIHTMLSource::GetSource() const { void BookmarksUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { NOTREACHED() << "We should never get here since the extension should have" << "been triggered"; diff --git a/chrome/browser/ui/webui/bookmarks_ui.h b/chrome/browser/ui/webui/bookmarks_ui.h index 62fcc95..54eaca1 100644 --- a/chrome/browser/ui/webui/bookmarks_ui.h +++ b/chrome/browser/ui/webui/bookmarks_ui.h @@ -26,7 +26,7 @@ class BookmarksUIHTMLSource : 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& path) const OVERRIDE; diff --git a/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc b/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc index d6ec467..71c2f0b 100644 --- a/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc +++ b/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.cc @@ -36,7 +36,7 @@ std::string ScreenlockIconSource::GetSource() const { void ScreenlockIconSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { if (!icon_provider_) { callback.Run(GetDefaultIcon().As1xPNGBytes()); diff --git a/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h b/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h index fcabc2d..3d4bdf6 100644 --- a/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h +++ b/chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h @@ -23,7 +23,7 @@ class ScreenlockIconSource : 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& path) const OVERRIDE; diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index 486ce96..5dcc4bd 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -148,7 +148,7 @@ class MobileSetupUIHTMLSource : 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 { return "text/html"; @@ -271,7 +271,7 @@ std::string MobileSetupUIHTMLSource::GetSource() const { void MobileSetupUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { NetworkHandler::Get()->network_configuration_handler()->GetProperties( path, diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc index c46dfc6..b015146 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc +++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc @@ -37,7 +37,7 @@ class ProxySettingsHTMLSource : 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 { return "text/html"; @@ -67,7 +67,7 @@ std::string ProxySettingsHTMLSource::GetSource() const { void ProxySettingsHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { webui::SetFontAndTextDirection(localized_strings_.get()); diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index 3a80401..c5f383e 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc @@ -87,7 +87,7 @@ class SimUnlockUIHTMLSource : 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 { return "text/html"; @@ -290,7 +290,7 @@ std::string SimUnlockUIHTMLSource::GetSource() const { void SimUnlockUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { DictionaryValue strings; strings.SetString("title", diff --git a/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc b/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc index 19f568c..208a816e 100644 --- a/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc +++ b/chrome/browser/ui/webui/chromeos/slow_trace_ui.cc @@ -34,7 +34,7 @@ std::string SlowTraceSource::GetSource() const { void SlowTraceSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { int trace_id = 0; size_t pos = path.find('#'); diff --git a/chrome/browser/ui/webui/chromeos/slow_trace_ui.h b/chrome/browser/ui/webui/chromeos/slow_trace_ui.h index 82f192f..97878c7 100644 --- a/chrome/browser/ui/webui/chromeos/slow_trace_ui.h +++ b/chrome/browser/ui/webui/chromeos/slow_trace_ui.h @@ -32,7 +32,7 @@ class SlowTraceSource : 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& path) const OVERRIDE; diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index df95d3b..6e02e89 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -122,14 +122,14 @@ class DevToolsDataSource : 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 { std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); bundled_path_prefix += "/"; if (StartsWithASCII(path, bundled_path_prefix, false)) { StartBundledDataRequest(path.substr(bundled_path_prefix.length()), render_process_id, - render_view_id, + render_frame_id, callback); return; } @@ -138,7 +138,7 @@ class DevToolsDataSource : public content::URLDataSource { if (StartsWithASCII(path, remote_path_prefix, false)) { StartRemoteDataRequest(path.substr(remote_path_prefix.length()), render_process_id, - render_view_id, + render_frame_id, callback); return; } @@ -148,7 +148,7 @@ class DevToolsDataSource : public content::URLDataSource { void StartBundledDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { std::string filename = PathWithoutParams(path); @@ -168,7 +168,7 @@ class DevToolsDataSource : public content::URLDataSource { void StartRemoteDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { GURL url = GURL(kRemoteFrontendBase + path); CHECK_EQ(url.host(), kRemoteFrontendDomain); diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index 92ec916..9bd7db8 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -118,7 +118,7 @@ std::string ExtensionIconSource::GetMimeType(const std::string&) const { void ExtensionIconSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { // This is where everything gets started. First, parse the request and make // the request data available for later. diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.h b/chrome/browser/ui/webui/extensions/extension_icon_source.h index 7a94d11..def0324 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.h +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.h @@ -75,7 +75,7 @@ class ExtensionIconSource : 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; private: diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 765b804..cef2344 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -61,7 +61,7 @@ std::string FaviconSource::GetSource() const { void FaviconSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); diff --git a/chrome/browser/ui/webui/favicon_source.h b/chrome/browser/ui/webui/favicon_source.h index 13203173..1d52562 100644 --- a/chrome/browser/ui/webui/favicon_source.h +++ b/chrome/browser/ui/webui/favicon_source.h @@ -75,7 +75,7 @@ class FaviconSource : 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; virtual bool ShouldReplaceExistingSource() const OVERRIDE; diff --git a/chrome/browser/ui/webui/fileicon_source.cc b/chrome/browser/ui/webui/fileicon_source.cc index 5d57416..3da4336 100644 --- a/chrome/browser/ui/webui/fileicon_source.cc +++ b/chrome/browser/ui/webui/fileicon_source.cc @@ -130,7 +130,7 @@ std::string FileIconSource::GetSource() const { void FileIconSource::StartDataRequest( const std::string& url_path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { std::string query; base::FilePath file_path; diff --git a/chrome/browser/ui/webui/fileicon_source.h b/chrome/browser/ui/webui/fileicon_source.h index ebc796d..c5a73ea 100644 --- a/chrome/browser/ui/webui/fileicon_source.h +++ b/chrome/browser/ui/webui/fileicon_source.h @@ -28,7 +28,7 @@ class FileIconSource : 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/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index ed82f70..e9f7a9e 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -353,7 +353,7 @@ std::string NewTabUI::NewTabHTMLSource::GetSource() const { void NewTabUI::NewTabHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h index b28775a..7421f87 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.h +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h @@ -92,7 +92,7 @@ class NewTabUI : public content::WebUIController, 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; virtual bool ShouldReplaceExistingSource() const OVERRIDE; diff --git a/chrome/browser/ui/webui/ntp/thumbnail_list_source.cc b/chrome/browser/ui/webui/ntp/thumbnail_list_source.cc index f4be12d..69a7dfd 100644 --- a/chrome/browser/ui/webui/ntp/thumbnail_list_source.cc +++ b/chrome/browser/ui/webui/ntp/thumbnail_list_source.cc @@ -92,7 +92,7 @@ std::string ThumbnailListSource::GetSource() const { void ThumbnailListSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { profile_->GetTopSites()->GetMostVisitedURLs( base::Bind(&ThumbnailListSource::OnMostVisitedURLsAvailable, diff --git a/chrome/browser/ui/webui/ntp/thumbnail_list_source.h b/chrome/browser/ui/webui/ntp/thumbnail_list_source.h index 3e04ead..605c9c2 100644 --- a/chrome/browser/ui/webui/ntp/thumbnail_list_source.h +++ b/chrome/browser/ui/webui/ntp/thumbnail_list_source.h @@ -36,7 +36,7 @@ class ThumbnailListSource : 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& path) const OVERRIDE; virtual base::MessageLoop* MessageLoopForRequestPath( diff --git a/chrome/browser/ui/webui/ntp/thumbnail_source.cc b/chrome/browser/ui/webui/ntp/thumbnail_source.cc index f3a1c6d..b2ad802 100644 --- a/chrome/browser/ui/webui/ntp/thumbnail_source.cc +++ b/chrome/browser/ui/webui/ntp/thumbnail_source.cc @@ -37,7 +37,7 @@ std::string ThumbnailSource::GetSource() const { void ThumbnailSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { scoped_refptr<base::RefCountedMemory> data; if (thumbnail_service_->GetPageThumbnail(GURL(path), capture_thumbnails_, diff --git a/chrome/browser/ui/webui/ntp/thumbnail_source.h b/chrome/browser/ui/webui/ntp/thumbnail_source.h index 167dffa..e0d7f05 100644 --- a/chrome/browser/ui/webui/ntp/thumbnail_source.h +++ b/chrome/browser/ui/webui/ntp/thumbnail_source.h @@ -32,7 +32,7 @@ class ThumbnailSource : 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& path) const OVERRIDE; virtual base::MessageLoop* MessageLoopForRequestPath( diff --git a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc index 5d56278..ee359fd 100644 --- a/chrome/browser/ui/webui/options/chromeos/user_image_source.cc +++ b/chrome/browser/ui/webui/options/chromeos/user_image_source.cc @@ -89,7 +89,7 @@ std::string UserImageSource::GetSource() const { void UserImageSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { std::string email; bool is_image_animated = false; diff --git a/chrome/browser/ui/webui/options/chromeos/user_image_source.h b/chrome/browser/ui/webui/options/chromeos/user_image_source.h index 362a447..f7a2fb6 100644 --- a/chrome/browser/ui/webui/options/chromeos/user_image_source.h +++ b/chrome/browser/ui/webui/options/chromeos/user_image_source.h @@ -31,7 +31,7 @@ class UserImageSource : 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& path) const OVERRIDE; diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc index fb2ec20..65cdaa1 100644 --- a/chrome/browser/ui/webui/options/options_ui.cc +++ b/chrome/browser/ui/webui/options/options_ui.cc @@ -120,7 +120,7 @@ class OptionsUIHTMLSource : 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; virtual bool ShouldDenyXFrameOptions() const OVERRIDE; @@ -146,7 +146,7 @@ std::string OptionsUIHTMLSource::GetSource() const { void OptionsUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { scoped_refptr<base::RefCountedMemory> response_bytes; webui::SetFontAndTextDirection(localized_strings_.get()); diff --git a/chrome/browser/ui/webui/system_info_ui.cc b/chrome/browser/ui/webui/system_info_ui.cc index 900f1ab..7d757e5 100644 --- a/chrome/browser/ui/webui/system_info_ui.cc +++ b/chrome/browser/ui/webui/system_info_ui.cc @@ -51,7 +51,7 @@ class SystemInfoUIHTMLSource : 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 { return "text/html"; @@ -105,7 +105,7 @@ std::string SystemInfoUIHTMLSource::GetSource() const { void SystemInfoUIHTMLSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { path_ = path; callback_ = callback; diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc index b161177..4489807 100644 --- a/chrome/browser/ui/webui/theme_source.cc +++ b/chrome/browser/ui/webui/theme_source.cc @@ -59,7 +59,7 @@ std::string ThemeSource::GetSource() const { void ThemeSource::StartDataRequest( const std::string& path, int render_process_id, - int render_view_id, + int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { // Default scale factor if not specified. ui::ScaleFactor scale_factor; diff --git a/chrome/browser/ui/webui/theme_source.h b/chrome/browser/ui/webui/theme_source.h index b4f3f0c..6b937732 100644 --- a/chrome/browser/ui/webui/theme_source.h +++ b/chrome/browser/ui/webui/theme_source.h @@ -28,7 +28,7 @@ class ThemeSource : 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& path) const OVERRIDE; virtual base::MessageLoop* MessageLoopForRequestPath( diff --git a/chrome/test/base/web_ui_browsertest.cc b/chrome/test/base/web_ui_browsertest.cc index 182211b..dbcc2f6 100644 --- a/chrome/test/base/web_ui_browsertest.cc +++ b/chrome/test/base/web_ui_browsertest.cc @@ -360,7 +360,7 @@ class MockWebUIDataSource : 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 { std::string dummy_html = "<html><body>Dummy</body></html>"; scoped_refptr<base::RefCountedString> response = 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 |