| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PROXY_URL_LOADER_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_URL_LOADER_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_URL_LOADER_RESOURCE_H_ | 6 #define PPAPI_PROXY_URL_LOADER_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 PP_Instance instance); | 29 PP_Instance instance); |
| 30 | 30 |
| 31 // Constructor for renderer-initiated (document) loads. The loader ID is the | 31 // Constructor for renderer-initiated (document) loads. The loader ID is the |
| 32 // pending host ID for the already-created host in the renderer, and the | 32 // pending host ID for the already-created host in the renderer, and the |
| 33 // response data is the response for the already-opened connection. | 33 // response data is the response for the already-opened connection. |
| 34 URLLoaderResource(Connection connection, | 34 URLLoaderResource(Connection connection, |
| 35 PP_Instance instance, | 35 PP_Instance instance, |
| 36 int pending_main_document_loader_id, | 36 int pending_main_document_loader_id, |
| 37 const URLResponseInfoData& data); | 37 const URLResponseInfoData& data); |
| 38 | 38 |
| 39 virtual ~URLLoaderResource(); | 39 ~URLLoaderResource() override; |
| 40 | 40 |
| 41 // Resource override. | 41 // Resource override. |
| 42 thunk::PPB_URLLoader_API* AsPPB_URLLoader_API() override; | 42 thunk::PPB_URLLoader_API* AsPPB_URLLoader_API() override; |
| 43 | 43 |
| 44 // PPB_URLLoader_API implementation. | 44 // PPB_URLLoader_API implementation. |
| 45 virtual int32_t Open(PP_Resource request_id, | 45 int32_t Open(PP_Resource request_id, |
| 46 scoped_refptr<TrackedCallback> callback) override; | 46 scoped_refptr<TrackedCallback> callback) override; |
| 47 virtual int32_t Open(const URLRequestInfoData& data, | 47 int32_t Open(const URLRequestInfoData& data, |
| 48 int requestor_pid, | 48 int requestor_pid, |
| 49 scoped_refptr<TrackedCallback> callback) override; | 49 scoped_refptr<TrackedCallback> callback) override; |
| 50 virtual int32_t FollowRedirect( | 50 int32_t FollowRedirect(scoped_refptr<TrackedCallback> callback) override; |
| 51 scoped_refptr<TrackedCallback> callback) override; | 51 PP_Bool GetUploadProgress(int64_t* bytes_sent, |
| 52 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, | 52 int64_t* total_bytes_to_be_sent) override; |
| 53 int64_t* total_bytes_to_be_sent) override; | 53 PP_Bool GetDownloadProgress( |
| 54 virtual PP_Bool GetDownloadProgress( | |
| 55 int64_t* bytes_received, | 54 int64_t* bytes_received, |
| 56 int64_t* total_bytes_to_be_received) override; | 55 int64_t* total_bytes_to_be_received) override; |
| 57 virtual PP_Resource GetResponseInfo() override; | 56 PP_Resource GetResponseInfo() override; |
| 58 virtual int32_t ReadResponseBody( | 57 int32_t ReadResponseBody( |
| 59 void* buffer, | 58 void* buffer, |
| 60 int32_t bytes_to_read, | 59 int32_t bytes_to_read, |
| 61 scoped_refptr<TrackedCallback> callback) override; | 60 scoped_refptr<TrackedCallback> callback) override; |
| 62 virtual int32_t FinishStreamingToFile( | 61 int32_t FinishStreamingToFile( |
| 63 scoped_refptr<TrackedCallback> callback) override; | 62 scoped_refptr<TrackedCallback> callback) override; |
| 64 virtual void Close() override; | 63 void Close() override; |
| 65 virtual void GrantUniversalAccess() override; | 64 void GrantUniversalAccess() override; |
| 66 virtual void RegisterStatusCallback( | 65 void RegisterStatusCallback( |
| 67 PP_URLLoaderTrusted_StatusCallback callback) override; | 66 PP_URLLoaderTrusted_StatusCallback callback) override; |
| 68 | 67 |
| 69 // PluginResource implementation. | 68 // PluginResource implementation. |
| 70 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 69 void OnReplyReceived(const ResourceMessageReplyParams& params, |
| 71 const IPC::Message& msg) override; | 70 const IPC::Message& msg) override; |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 enum Mode { | 73 enum Mode { |
| 75 // The plugin has not called Open() yet. | 74 // The plugin has not called Open() yet. |
| 76 MODE_WAITING_TO_OPEN, | 75 MODE_WAITING_TO_OPEN, |
| 77 | 76 |
| 78 // The plugin is waiting for the Open() or FollowRedirect callback. | 77 // The plugin is waiting for the Open() or FollowRedirect callback. |
| 79 MODE_OPENING, | 78 MODE_OPENING, |
| 80 | 79 |
| 81 // We've started to receive data and may receive more. | 80 // We've started to receive data and may receive more. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // The response info if we've received it. | 136 // The response info if we've received it. |
| 138 scoped_refptr<URLResponseInfoResource> response_info_; | 137 scoped_refptr<URLResponseInfoResource> response_info_; |
| 139 | 138 |
| 140 DISALLOW_COPY_AND_ASSIGN(URLLoaderResource); | 139 DISALLOW_COPY_AND_ASSIGN(URLLoaderResource); |
| 141 }; | 140 }; |
| 142 | 141 |
| 143 } // namespace proxy | 142 } // namespace proxy |
| 144 } // namespace ppapi | 143 } // namespace ppapi |
| 145 | 144 |
| 146 #endif // PPAPI_PROXY_URL_LOADER_RESOURCE_H_ | 145 #endif // PPAPI_PROXY_URL_LOADER_RESOURCE_H_ |
| OLD | NEW |