| Index: ppapi/proxy/error_conversion.cc
|
| diff --git a/ppapi/host/error_conversion.cc b/ppapi/proxy/error_conversion.cc
|
| similarity index 80%
|
| rename from ppapi/host/error_conversion.cc
|
| rename to ppapi/proxy/error_conversion.cc
|
| index da985d399661ae82a03b4050bb3ff1f5a03a0088..b842e67771f5c1c649ad9f4eede7ba7f03293b74 100644
|
| --- a/ppapi/host/error_conversion.cc
|
| +++ b/ppapi/proxy/error_conversion.cc
|
| @@ -2,14 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ppapi/host/error_conversion.h"
|
| +#include "ppapi/proxy/error_conversion.h"
|
|
|
| #include "base/safe_numerics.h"
|
| #include "net/base/net_errors.h"
|
| #include "ppapi/c/pp_errors.h"
|
|
|
| namespace ppapi {
|
| -namespace host {
|
| +namespace proxy {
|
|
|
| int32_t NetErrorToPepperError(int net_error) {
|
| if (net_error > 0)
|
| @@ -71,5 +71,18 @@ int32_t NetErrorToPepperError(int net_error) {
|
| }
|
| }
|
|
|
| -} // namespace host
|
| +int32_t ConvertNetworkAPIErrorForCompatibility(int32_t pp_error,
|
| + bool private_api) {
|
| + // The private API doesn't return network-specific error codes or
|
| + // PP_ERROR_NOACCESS. In order to preserve the behavior, we convert those to
|
| + // PP_ERROR_FAILED.
|
| + if (private_api &&
|
| + (pp_error <= PP_ERROR_CONNECTION_CLOSED ||
|
| + pp_error == PP_ERROR_NOACCESS)) {
|
| + return PP_ERROR_FAILED;
|
| + }
|
| + return pp_error;
|
| +}
|
| +
|
| +} // namespace proxy
|
| } // namespace ppapi
|
|
|