Chromium Code Reviews| Index: ppapi/shared_impl/private/ppb_flash_x509_certificate_shared.h |
| diff --git a/ppapi/shared_impl/private/ppb_flash_x509_certificate_shared.h b/ppapi/shared_impl/private/ppb_flash_x509_certificate_shared.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1badf2fd95fa84807eabfa1261a7f628ba3dcf0 |
| --- /dev/null |
| +++ b/ppapi/shared_impl/private/ppb_flash_x509_certificate_shared.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_FLASH_X509_CERTIFICATE_IMPL_H_ |
| +#define PPAPI_SHARED_IMPL_PRIVATE_PPB_FLASH_X509_CERTIFICATE_IMPL_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/values.h" |
| +#include "ppapi/c/private/ppb_flash_x509_certificate.h" |
| +#include "ppapi/shared_impl/resource.h" |
| +#include "ppapi/thunk/ppb_flash_x509_certificate_api.h" |
| + |
| +namespace IPC { |
| +template <class T> |
| +struct ParamTraits; |
| +} |
| + |
| +namespace ppapi { |
| + |
| +class PPB_X509Certificate_Fields { |
|
yzshen1
2012/03/22 23:32:40
Does it need PPAPI_SHARED_EXPORT?
raymes
2012/03/26 16:05:57
Done.
|
| + public: |
| + // Takes ownership of |value|. |
| + void SetField(PP_Flash_X509Certificate_Field field, base::Value* value); |
| + PP_Var GetFieldAsPPVar(PP_Flash_X509Certificate_Field field) const; |
| + |
| + private: |
| + // Friend so ParamTraits can serialize us. |
| + friend struct IPC::ParamTraits<ppapi::PPB_X509Certificate_Fields>; |
| + |
| + base::ListValue values_; |
| +}; |
| + |
| +//------------------------------------------------------------------------------ |
| + |
| +class PPAPI_SHARED_EXPORT PPB_Flash_X509Certificate_Shared |
| + : public thunk::PPB_Flash_X509Certificate_API, |
| + public Resource { |
| + public: |
| + PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| + PP_Instance instance); |
| + // Used by tcp_socket_shared_impl to construct a certificate resource from a |
| + // server certificate. This object owns the pointer passed in. |
| + PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| + PP_Instance instance, |
| + PPB_X509Certificate_Fields* fields); |
| + virtual ~PPB_Flash_X509Certificate_Shared(); |
| + |
| + // Resource overrides. |
| + virtual PPB_Flash_X509Certificate_API* |
| + AsPPB_Flash_X509Certificate_API() OVERRIDE; |
| + |
| + // PPB_Flash_X509Certificate_API implementation. |
| + virtual PP_Bool Initialize(const char* bytes, uint32_t length) OVERRIDE; |
| + virtual PP_Var GetField(PP_Flash_X509Certificate_Field field) OVERRIDE; |
| + |
| + protected: |
| + virtual bool ParseDER(const std::vector<char>& der, |
| + PPB_X509Certificate_Fields* result); |
| + |
| + private: |
| + scoped_ptr<PPB_X509Certificate_Fields> fields_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PPB_Flash_X509Certificate_Shared); |
| +}; |
| + |
| +} // namespace ppapi |
| + |
| +#endif // PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ |