diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-07 21:24:18 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-07 21:24:18 +0000 |
commit | 60cf2db2288f8808e7afdc4a19164df35db7e455 (patch) | |
tree | bd24d6ef8e4ad485bb6a10b5d14fd643d375d185 /content/public | |
parent | a4d16a729a56cb09a6f0d4fcdeee5d910734375d (diff) | |
download | chromium_src-60cf2db2288f8808e7afdc4a19164df35db7e455.zip chromium_src-60cf2db2288f8808e7afdc4a19164df35db7e455.tar.gz chromium_src-60cf2db2288f8808e7afdc4a19164df35db7e455.tar.bz2 |
Add ResourceRequestInfo.
ResourceRequestInfo exposes the members of ResourceDispatcherHostRequestInfo required by src/chrome.
ResourceDispatcherHostRequestInfo remains for use by src/content (maybe it should have a different name), and ResourceDispatcherHostRequestInfo subclasses ResourceRequestInfo.
ResourceDispatcherHost::RenderViewForRequest is removed in favor of ResourceRequestInfo::GetAssociatedRenderView(). src/chrome uses ResourceRequestInfo::ForRequest(URLRequest*) instead of ResourceDispatcherHost::InfoForRequest.
Deletes DummyResourceHandler in favor of just having ~ResourceDispatcherHostRequestInfo null-test its ResourceHandler.
R=jam@chromium.org
TBR=mirandac@chromium.org,ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9580002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/browser/resource_request_info.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/content/public/browser/resource_request_info.h b/content/public/browser/resource_request_info.h new file mode 100644 index 0000000..1339d42 --- /dev/null +++ b/content/public/browser/resource_request_info.h @@ -0,0 +1,86 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ +#define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ +#pragma once + +#include "base/basictypes.h" +#include "content/common/content_export.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" +#include "webkit/glue/resource_type.h" + +namespace net { +class URLRequest; +} + +namespace content { +class ResourceContext; + +// Each URLRequest allocated by the ResourceDispatcherHost has a +// ResourceRequestInfo instance associated with it. +class ResourceRequestInfo { + public: + // Returns the ResourceRequestInfo associated with the given URLRequest. + CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( + const net::URLRequest* request); + + // Allocates a new, dummy ResourceRequestInfo and associates it with the + // given URLRequest. + // NOTE: Add more parameters if you need to initialize other fields. + CONTENT_EXPORT static void AllocateForTesting( + net::URLRequest* request, + ResourceContext* context); + + // Returns the associated ResourceContext. + virtual ResourceContext* GetContext() const = 0; + + // The child process unique ID of the requestor. + virtual int GetChildID() const = 0; + + // The IPC route identifier for this request (this identifies the RenderView + // or like-thing in the renderer that the request gets routed to). + virtual int GetRouteID() const = 0; + + // The pid of the originating process, if the request is sent on behalf of a + // another process. Otherwise it is 0. + virtual int GetOriginPID() const = 0; + + // Unique identifier (within the scope of the child process) for this request. + virtual int GetRequestID() const = 0; + + // True if GetFrameID() represents a main frame in the RenderView. + virtual bool IsMainFrame() const = 0; + + // Frame ID that sent this resource request. -1 if unknown / invalid. + virtual int64 GetFrameID() const = 0; + + // True if GetParentFrameID() represents a main frame in the RenderView. + virtual bool ParentIsMainFrame() const = 0; + + // Frame ID of parent frame of frame that sent this resource request. + // -1 if unknown / invalid. + virtual int64 GetParentFrameID() const = 0; + + // Returns the associated resource type. + virtual ResourceType::Type GetResourceType() const = 0; + + // Returns the associated referrer policy. + virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const = 0; + + // When there is upload data, this is the byte count of that data. When there + // is no upload, this will be 0. + virtual uint64 GetUploadSize() const = 0; + + // Returns false if there is NOT an associated render view. + virtual bool GetAssociatedRenderView(int* render_process_id, + int* render_view_id) const = 0; + + protected: + virtual ~ResourceRequestInfo() {} +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |