Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / child / resource_dispatcher.h
index e4a2d4f..d407579 100644 (file)
 #include "content/common/content_export.h"
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_sender.h"
-#include "webkit/child/resource_loader_bridge.h"
+#include "net/base/request_priority.h"
 #include "webkit/common/resource_type.h"
 
 struct ResourceMsg_RequestCompleteData;
 
+namespace webkit_glue {
+class ResourceLoaderBridge;
+struct ResourceResponseInfo;
+}
+
 namespace content {
+class RequestPeer;
 class ResourceDispatcherDelegate;
 struct RequestInfo;
 struct ResourceResponseHead;
@@ -46,31 +52,32 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
   webkit_glue::ResourceLoaderBridge* CreateBridge(
       const RequestInfo& request_info);
 
-  // Adds a request from the pending_requests_ list, returning the new
-  // requests' ID
-  int AddPendingRequest(webkit_glue::ResourceLoaderBridge::Peer* callback,
+  // Adds a request from the |pending_requests_| list, returning the new
+  // requests' ID.
+  int AddPendingRequest(RequestPeer* callback,
                         ResourceType::Type resource_type,
                         int origin_pid,
                         const GURL& frame_origin,
-                        const GURL& request_url);
+                        const GURL& request_url,
+                        bool download_to_file);
 
-  // Removes a request from the pending_requests_ list, returning true if the
+  // Removes a request from the |pending_requests_| list, returning true if the
   // request was found and removed.
   bool RemovePendingRequest(int request_id);
 
-  // Cancels a request in the pending_requests_ list.
+  // Cancels a request in the |pending_requests_| list.
   void CancelPendingRequest(int request_id);
 
-  IPC::Sender* message_sender() const {
-    return message_sender_;
-  }
-
   // Toggles the is_deferred attribute for the specified request.
   void SetDefersLoading(int request_id, bool value);
 
   // Indicates the priority of the specified request changed.
-  void DidChangePriority(int routing_id, int request_id,
-                         net::RequestPriority new_priority);
+  void DidChangePriority(int routing_id,
+                         int request_id,
+                         net::RequestPriority new_priority,
+                         int intra_priority_value);
+
+  IPC::Sender* message_sender() const { return message_sender_; }
 
   // This does not take ownership of the delegate. It is expected that the
   // delegate have a longer lifetime than the ResourceDispatcher.
@@ -90,15 +97,16 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
   struct PendingRequestInfo {
     PendingRequestInfo();
 
-    PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer,
+    PendingRequestInfo(RequestPeer* peer,
                        ResourceType::Type resource_type,
                        int origin_pid,
                        const GURL& frame_origin,
-                       const GURL& request_url);
+                       const GURL& request_url,
+                       bool download_to_file);
 
     ~PendingRequestInfo();
 
-    webkit_glue::ResourceLoaderBridge::Peer* peer;
+    RequestPeer* peer;
     ResourceType::Type resource_type;
     // The PID of the original process which issued this request. This gets
     // non-zero only for a request proxied by another renderer, particularly
@@ -106,12 +114,14 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
     int origin_pid;
     MessageQueue deferred_message_queue;
     bool is_deferred;
+    bool is_canceled;
     // Original requested url.
     GURL url;
     // The security origin of the frame that initiates this request.
     GURL frame_origin;
     // The url of the latest response even in case of redirection.
     GURL response_url;
+    bool download_to_file;
     linked_ptr<IPC::Message> pending_redirect_message;
     base::TimeTicks request_start;
     base::TimeTicks response_start;
@@ -131,33 +141,24 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
   void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info);
 
   // Message response handlers, called by the message handler for this process.
-  void OnUploadProgress(
-      int request_id,
-      int64 position,
-      int64 size);
+  void OnUploadProgress(int request_id, int64 position, int64 size);
   void OnReceivedResponse(int request_id, const ResourceResponseHead&);
   void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data);
-  void OnReceivedRedirect(
-      int request_id,
-      const GURL& new_url,
-      const ResourceResponseHead& response_head);
-  void OnSetDataBuffer(
-      int request_id,
-      base::SharedMemoryHandle shm_handle,
-      int shm_size,
-      base::ProcessId renderer_pid);
-  void OnReceivedData(
-      int request_id,
-      int data_offset,
-      int data_length,
-      int encoded_data_length);
-  void OnDownloadedData(
-      int request_id,
-      int data_len,
-      int encoded_data_length);
+  void OnReceivedRedirect(int request_id,
+                          const GURL& new_url,
+                          const ResourceResponseHead& response_head);
+  void OnSetDataBuffer(int request_id,
+                       base::SharedMemoryHandle shm_handle,
+                       int shm_size,
+                       base::ProcessId renderer_pid);
+  void OnReceivedData(int request_id,
+                      int data_offset,
+                      int data_length,
+                      int encoded_data_length);
+  void OnDownloadedData(int request_id, int data_len, int encoded_data_length);
   void OnRequestComplete(
       int request_id,
-      const ResourceMsg_RequestCompleteData &request_complete_data);
+      const ResourceMsg_RequestCompleteDatarequest_complete_data);
 
   // Dispatch the message to one of the message response handlers.
   void DispatchMessage(const IPC::Message& message);