Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ppapi/cpp/url_loader.cc

Issue 4747001: Move URLLoader, URLRequestInfo, and URLResponseInfo out of the dev directory... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/url_loader.h ('k') | ppapi/cpp/url_request_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #include "ppapi/cpp/dev/url_loader_dev.h" 5 #include "ppapi/cpp/url_loader.h"
6 6
7 #include "ppapi/c/dev/ppb_url_loader_dev.h" 7 #include "ppapi/c/ppb_url_loader.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/common.h" 9 #include "ppapi/cpp/common.h"
10 #include "ppapi/cpp/completion_callback.h" 10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/dev/file_ref_dev.h" 11 #include "ppapi/cpp/dev/file_ref_dev.h"
12 #include "ppapi/cpp/dev/url_request_info_dev.h"
13 #include "ppapi/cpp/dev/url_response_info_dev.h"
14 #include "ppapi/cpp/instance.h" 12 #include "ppapi/cpp/instance.h"
15 #include "ppapi/cpp/module.h" 13 #include "ppapi/cpp/module.h"
16 #include "ppapi/cpp/module_impl.h" 14 #include "ppapi/cpp/module_impl.h"
15 #include "ppapi/cpp/url_request_info.h"
16 #include "ppapi/cpp/url_response_info.h"
17 17
18 namespace { 18 namespace {
19 19
20 DeviceFuncs<PPB_URLLoader_Dev> url_loader_f(PPB_URLLOADER_DEV_INTERFACE); 20 DeviceFuncs<PPB_URLLoader> url_loader_f(PPB_URLLOADER_INTERFACE);
21 21
22 } // namespace 22 } // namespace
23 23
24 namespace pp { 24 namespace pp {
25 25
26 URLLoader_Dev::URLLoader_Dev(PP_Resource resource) : Resource(resource) { 26 URLLoader::URLLoader(PP_Resource resource) : Resource(resource) {
27 } 27 }
28 28
29 URLLoader_Dev::URLLoader_Dev(const Instance& instance) { 29 URLLoader::URLLoader(const Instance& instance) {
30 if (!url_loader_f) 30 if (!url_loader_f)
31 return; 31 return;
32 PassRefFromConstructor(url_loader_f->Create(instance.pp_instance())); 32 PassRefFromConstructor(url_loader_f->Create(instance.pp_instance()));
33 } 33 }
34 34
35 URLLoader_Dev::URLLoader_Dev(const URLLoader_Dev& other) 35 URLLoader::URLLoader(const URLLoader& other) : Resource(other) {
36 : Resource(other) {
37 } 36 }
38 37
39 URLLoader_Dev& URLLoader_Dev::operator=(const URLLoader_Dev& other) { 38 int32_t URLLoader::Open(const URLRequestInfo& request_info,
40 URLLoader_Dev copy(other); 39 const CompletionCallback& cc) {
41 swap(copy);
42 return *this;
43 }
44
45 void URLLoader_Dev::swap(URLLoader_Dev& other) {
46 Resource::swap(other);
47 }
48
49 int32_t URLLoader_Dev::Open(const URLRequestInfo_Dev& request_info,
50 const CompletionCallback& cc) {
51 if (!url_loader_f) 40 if (!url_loader_f)
52 return PP_ERROR_NOINTERFACE; 41 return PP_ERROR_NOINTERFACE;
53 return url_loader_f->Open(pp_resource(), request_info.pp_resource(), 42 return url_loader_f->Open(pp_resource(), request_info.pp_resource(),
54 cc.pp_completion_callback()); 43 cc.pp_completion_callback());
55 } 44 }
56 45
57 int32_t URLLoader_Dev::FollowRedirect(const CompletionCallback& cc) { 46 int32_t URLLoader::FollowRedirect(const CompletionCallback& cc) {
58 if (!url_loader_f) 47 if (!url_loader_f)
59 return PP_ERROR_NOINTERFACE; 48 return PP_ERROR_NOINTERFACE;
60 return url_loader_f->FollowRedirect(pp_resource(), 49 return url_loader_f->FollowRedirect(pp_resource(),
61 cc.pp_completion_callback()); 50 cc.pp_completion_callback());
62 } 51 }
63 52
64 bool URLLoader_Dev::GetUploadProgress(int64_t* bytes_sent, 53 bool URLLoader::GetUploadProgress(int64_t* bytes_sent,
65 int64_t* total_bytes_to_be_sent) const { 54 int64_t* total_bytes_to_be_sent) const {
66 if (!url_loader_f) 55 if (!url_loader_f)
67 return false; 56 return false;
68 return PPBoolToBool(url_loader_f->GetUploadProgress(pp_resource(), 57 return PPBoolToBool(url_loader_f->GetUploadProgress(pp_resource(),
69 bytes_sent, 58 bytes_sent,
70 total_bytes_to_be_sent)); 59 total_bytes_to_be_sent));
71 } 60 }
72 61
73 bool URLLoader_Dev::GetDownloadProgress( 62 bool URLLoader::GetDownloadProgress(
74 int64_t* bytes_received, 63 int64_t* bytes_received,
75 int64_t* total_bytes_to_be_received) const { 64 int64_t* total_bytes_to_be_received) const {
76 if (!url_loader_f) 65 if (!url_loader_f)
77 return false; 66 return false;
78 return PPBoolToBool( 67 return PPBoolToBool(
79 url_loader_f->GetDownloadProgress(pp_resource(), 68 url_loader_f->GetDownloadProgress(pp_resource(),
80 bytes_received, 69 bytes_received,
81 total_bytes_to_be_received)); 70 total_bytes_to_be_received));
82 } 71 }
83 72
84 URLResponseInfo_Dev URLLoader_Dev::GetResponseInfo() const { 73 URLResponseInfo URLLoader::GetResponseInfo() const {
85 if (!url_loader_f) 74 if (!url_loader_f)
86 return URLResponseInfo_Dev(); 75 return URLResponseInfo();
87 return URLResponseInfo_Dev(URLResponseInfo_Dev::PassRef(), 76 return URLResponseInfo(URLResponseInfo::PassRef(),
88 url_loader_f->GetResponseInfo(pp_resource())); 77 url_loader_f->GetResponseInfo(pp_resource()));
89 } 78 }
90 79
91 int32_t URLLoader_Dev::ReadResponseBody(char* buffer, 80 int32_t URLLoader::ReadResponseBody(char* buffer,
92 int32_t bytes_to_read, 81 int32_t bytes_to_read,
93 const CompletionCallback& cc) { 82 const CompletionCallback& cc) {
94 if (!url_loader_f) 83 if (!url_loader_f)
95 return PP_ERROR_NOINTERFACE; 84 return PP_ERROR_NOINTERFACE;
96 return url_loader_f->ReadResponseBody(pp_resource(), 85 return url_loader_f->ReadResponseBody(pp_resource(),
97 buffer, 86 buffer,
98 bytes_to_read, 87 bytes_to_read,
99 cc.pp_completion_callback()); 88 cc.pp_completion_callback());
100 } 89 }
101 90
102 int32_t URLLoader_Dev::FinishStreamingToFile(const CompletionCallback& cc) { 91 int32_t URLLoader::FinishStreamingToFile(const CompletionCallback& cc) {
103 if (!url_loader_f) 92 if (!url_loader_f)
104 return PP_ERROR_NOINTERFACE; 93 return PP_ERROR_NOINTERFACE;
105 return url_loader_f->FinishStreamingToFile(pp_resource(), 94 return url_loader_f->FinishStreamingToFile(pp_resource(),
106 cc.pp_completion_callback()); 95 cc.pp_completion_callback());
107 } 96 }
108 97
109 void URLLoader_Dev::Close() { 98 void URLLoader::Close() {
110 if (!url_loader_f) 99 if (!url_loader_f)
111 return; 100 return;
112 url_loader_f->Close(pp_resource()); 101 url_loader_f->Close(pp_resource());
113 } 102 }
114 103
115 } // namespace pp 104 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/url_loader.h ('k') | ppapi/cpp/url_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698