OLD | NEW |
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 "webkit/glue/plugins/pepper_url_request_info.h" | 5 #include "webkit/glue/plugins/pepper_url_request_info.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "third_party/ppapi/c/pp_var.h" | 9 #include "third_party/ppapi/c/pp_var.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 bool SetProperty(PP_Resource request_id, | 37 bool SetProperty(PP_Resource request_id, |
38 PP_URLRequestProperty property, | 38 PP_URLRequestProperty property, |
39 PP_Var var) { | 39 PP_Var var) { |
40 scoped_refptr<URLRequestInfo> request( | 40 scoped_refptr<URLRequestInfo> request( |
41 Resource::GetAs<URLRequestInfo>(request_id)); | 41 Resource::GetAs<URLRequestInfo>(request_id)); |
42 if (!request.get()) | 42 if (!request.get()) |
43 return false; | 43 return false; |
44 | 44 |
45 if (var.type == PP_VarType_Bool) | 45 if (var.type == PP_VARTYPE_BOOL) |
46 return request->SetBooleanProperty(property, var.value.as_bool); | 46 return request->SetBooleanProperty(property, var.value.as_bool); |
47 | 47 |
48 if (var.type == PP_VarType_String) | 48 if (var.type == PP_VARTYPE_STRING) |
49 return request->SetStringProperty(property, GetString(var)->value()); | 49 return request->SetStringProperty(property, GetString(var)->value()); |
50 | 50 |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 bool AppendDataToBody(PP_Resource request_id, PP_Var var) { | 54 bool AppendDataToBody(PP_Resource request_id, PP_Var var) { |
55 scoped_refptr<URLRequestInfo> request( | 55 scoped_refptr<URLRequestInfo> request( |
56 Resource::GetAs<URLRequestInfo>(request_id)); | 56 Resource::GetAs<URLRequestInfo>(request_id)); |
57 if (!request.get()) | 57 if (!request.get()) |
58 return false; | 58 return false; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property, | 110 bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property, |
111 bool value) { | 111 bool value) { |
112 NOTIMPLEMENTED(); // TODO(darin): Implement me! | 112 NOTIMPLEMENTED(); // TODO(darin): Implement me! |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property, | 116 bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property, |
117 const std::string& value) { | 117 const std::string& value) { |
118 // TODO(darin): Validate input. Perhaps at a different layer? | 118 // TODO(darin): Validate input. Perhaps at a different layer? |
119 switch (property) { | 119 switch (property) { |
120 case PP_URLRequestProperty_URL: | 120 case PP_URLREQUESTPROPERTY_URL: |
121 // Keep the url in a string instead of a URL object because it might not | 121 // Keep the url in a string instead of a URL object because it might not |
122 // be complete yet. | 122 // be complete yet. |
123 url_ = value; | 123 url_ = value; |
124 return true; | 124 return true; |
125 case PP_URLRequestProperty_Method: | 125 case PP_URLREQUESTPROPERTY_METHOD: |
126 web_request_.setHTTPMethod(WebString::fromUTF8(value)); | 126 web_request_.setHTTPMethod(WebString::fromUTF8(value)); |
127 return true; | 127 return true; |
128 case PP_URLRequestProperty_Headers: | 128 case PP_URLREQUESTPROPERTY_HEADERS: |
129 // TODO(darin): Support extra request headers | 129 // TODO(darin): Support extra request headers |
130 NOTIMPLEMENTED(); | 130 NOTIMPLEMENTED(); |
131 return false; | 131 return false; |
132 default: | 132 default: |
133 return false; | 133 return false; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 bool URLRequestInfo::AppendDataToBody(const std::string& data) { | 137 bool URLRequestInfo::AppendDataToBody(const std::string& data) { |
138 NOTIMPLEMENTED(); // TODO(darin): Implement me! | 138 NOTIMPLEMENTED(); // TODO(darin): Implement me! |
139 return false; | 139 return false; |
140 } | 140 } |
141 | 141 |
142 bool URLRequestInfo::AppendFileToBody(FileRef* file_ref, | 142 bool URLRequestInfo::AppendFileToBody(FileRef* file_ref, |
143 int64_t start_offset, | 143 int64_t start_offset, |
144 int64_t number_of_bytes, | 144 int64_t number_of_bytes, |
145 PP_Time expected_last_modified_time) { | 145 PP_Time expected_last_modified_time) { |
146 NOTIMPLEMENTED(); // TODO(darin): Implement me! | 146 NOTIMPLEMENTED(); // TODO(darin): Implement me! |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
150 } // namespace pepper | 150 } // namespace pepper |
OLD | NEW |