Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/proxy/url_request_info_resource.h" | 5 #include "ppapi/proxy/url_request_info_resource.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | |
| 7 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
| 8 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_file_ref_api.h" | 10 #include "ppapi/thunk/ppb_file_ref_api.h" |
| 10 | 11 |
| 11 namespace ppapi { | 12 namespace ppapi { |
| 12 namespace proxy { | 13 namespace proxy { |
| 13 | 14 |
| 14 URLRequestInfoResource::URLRequestInfoResource(Connection connection, | 15 URLRequestInfoResource::URLRequestInfoResource(Connection connection, |
| 15 PP_Instance instance, | 16 PP_Instance instance, |
| 16 const URLRequestInfoData& data) | 17 const URLRequestInfoData& data) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 break; | 60 break; |
| 60 case PP_VARTYPE_STRING: { | 61 case PP_VARTYPE_STRING: { |
| 61 StringVar* string = StringVar::FromPPVar(var); | 62 StringVar* string = StringVar::FromPPVar(var); |
| 62 if (string) | 63 if (string) |
| 63 result = PP_FromBool(SetStringProperty(property, string->value())); | 64 result = PP_FromBool(SetStringProperty(property, string->value())); |
| 64 break; | 65 break; |
| 65 } | 66 } |
| 66 default: | 67 default: |
| 67 break; | 68 break; |
| 68 } | 69 } |
| 70 if (!result) { | |
| 71 std::string error_msg("PPB_URLRequestInfo.SetProperty: Attempted to set a " | |
| 72 "value for PP_URLRequestProperty "); | |
| 73 error_msg += base::IntToString(property); | |
| 74 error_msg += ", but either this property type is invalid or its parameter " | |
| 75 "was inappropriate (e.g., the wrong type of PP_Var)."; | |
|
teravest
2014/12/12 18:39:49
It should be easy to see if the passed property is
| |
| 76 Log(PP_LOGLEVEL_ERROR, error_msg); | |
| 77 } | |
| 69 return result; | 78 return result; |
| 70 } | 79 } |
| 71 | 80 |
| 72 PP_Bool URLRequestInfoResource::AppendDataToBody(const void* data, | 81 PP_Bool URLRequestInfoResource::AppendDataToBody(const void* data, |
| 73 uint32_t len) { | 82 uint32_t len) { |
| 74 if (len > 0) { | 83 if (len > 0) { |
| 75 data_.body.push_back(URLRequestInfoData::BodyItem( | 84 data_.body.push_back(URLRequestInfoData::BodyItem( |
| 76 std::string(static_cast<const char*>(data), len))); | 85 std::string(static_cast<const char*>(data), len))); |
| 77 } | 86 } |
| 78 return PP_TRUE; | 87 return PP_TRUE; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 data_.has_custom_user_agent = true; | 215 data_.has_custom_user_agent = true; |
| 207 data_.custom_user_agent = value; | 216 data_.custom_user_agent = value; |
| 208 return true; | 217 return true; |
| 209 default: | 218 default: |
| 210 return false; | 219 return false; |
| 211 } | 220 } |
| 212 } | 221 } |
| 213 | 222 |
| 214 } // namespace proxy | 223 } // namespace proxy |
| 215 } // namespace ppapi | 224 } // namespace ppapi |
| OLD | NEW |