OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_URL_LOADER_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_URL_LOADER_H_ |
| 7 |
| 8 #include "webkit/glue/plugins/pepper_resource.h" |
| 9 |
| 10 typedef struct _pp_CompletionCallback PP_CompletionCallback; |
| 11 typedef struct _ppb_URLLoader PPB_URLLoader; |
| 12 |
| 13 namespace pepper { |
| 14 |
| 15 class PluginInstance; |
| 16 class URLRequestInfo; |
| 17 class URLResponseInfo; |
| 18 |
| 19 class URLLoader : public Resource { |
| 20 public: |
| 21 explicit URLLoader(PluginInstance* instance); |
| 22 virtual ~URLLoader(); |
| 23 |
| 24 // Returns a pointer to the interface implementing PPB_URLLoader that is |
| 25 // exposed to the plugin. |
| 26 static const PPB_URLLoader* GetInterface(); |
| 27 |
| 28 // Resource overrides. |
| 29 URLLoader* AsURLLoader() { return this; } |
| 30 |
| 31 // PPB_URLLoader implementation. |
| 32 int32_t Open(URLRequestInfo* request, PP_CompletionCallback callback); |
| 33 int32_t FollowRedirect(PP_CompletionCallback callback); |
| 34 int32_t ReadResponseBody(char* buffer, int32_t bytes_to_read, |
| 35 PP_CompletionCallback callback); |
| 36 void Close(); |
| 37 |
| 38 URLResponseInfo* response_info() const { return response_info_; } |
| 39 |
| 40 // Progress counters: |
| 41 int64_t bytes_sent() const { return bytes_sent_; } |
| 42 int64_t total_bytes_to_be_sent() const { return total_bytes_to_be_sent_; } |
| 43 int64_t bytes_received() const { return bytes_received_; } |
| 44 int64_t total_bytes_to_be_received() const { |
| 45 return total_bytes_to_be_received_; |
| 46 } |
| 47 |
| 48 private: |
| 49 scoped_refptr<URLResponseInfo> response_info_; |
| 50 int64_t bytes_sent_; |
| 51 int64_t total_bytes_to_be_sent_; |
| 52 int64_t bytes_received_; |
| 53 int64_t total_bytes_to_be_received_; |
| 54 }; |
| 55 |
| 56 } // namespace pepper |
| 57 |
| 58 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_URL_LOADER_H_ |
OLD | NEW |