| 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 #ifndef PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ |
| 6 #define PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "ppapi/c/private/ppb_flash_x509_certificate.h" | 12 #include "ppapi/c/private/ppb_flash_x509_certificate.h" |
| 13 #include "ppapi/shared_impl/resource.h" | 13 #include "ppapi/shared_impl/resource.h" |
| 14 #include "ppapi/thunk/ppb_flash_x509_certificate_api.h" | 14 #include "ppapi/thunk/ppb_flash_x509_certificate_api.h" |
| 15 | 15 |
| 16 namespace IPC { | 16 namespace IPC { |
| 17 template <class T> | 17 template <class T> |
| 18 struct ParamTraits; | 18 struct ParamTraits; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ppapi { | 21 namespace ppapi { |
| 22 | 22 |
| 23 class PPB_X509Certificate_Fields { | 23 class PPB_X509Certificate_Fields { |
| 24 public: | 24 public: |
| 25 PPB_X509Certificate_Fields(); |
| 26 PPB_X509Certificate_Fields(const PPB_X509Certificate_Fields& fields); |
| 25 virtual ~PPB_X509Certificate_Fields(); | 27 virtual ~PPB_X509Certificate_Fields(); |
| 26 | 28 |
| 27 // Takes ownership of |value|. | 29 // Takes ownership of |value|. |
| 28 void SetField(PP_Flash_X509Certificate_Field field, base::Value* value); | 30 void SetField(PP_Flash_X509Certificate_Field field, base::Value* value); |
| 29 PP_Var GetFieldAsPPVar(PP_Flash_X509Certificate_Field field) const; | 31 PP_Var GetFieldAsPPVar(PP_Flash_X509Certificate_Field field) const; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // Friend so ParamTraits can serialize us. | 34 // Friend so ParamTraits can serialize us. |
| 33 friend struct IPC::ParamTraits<ppapi::PPB_X509Certificate_Fields>; | 35 friend struct IPC::ParamTraits<ppapi::PPB_X509Certificate_Fields>; |
| 34 | 36 |
| 35 base::ListValue values_; | 37 base::ListValue values_; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 //------------------------------------------------------------------------------ | 40 //------------------------------------------------------------------------------ |
| 39 | 41 |
| 40 class PPAPI_SHARED_EXPORT PPB_Flash_X509Certificate_Shared | 42 class PPAPI_SHARED_EXPORT PPB_Flash_X509Certificate_Shared |
| 41 : public thunk::PPB_Flash_X509Certificate_API, | 43 : public thunk::PPB_Flash_X509Certificate_API, |
| 42 public Resource { | 44 public Resource { |
| 43 public: | 45 public: |
| 44 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, | 46 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| 45 PP_Instance instance); | 47 PP_Instance instance); |
| 46 // Used by tcp_socket_shared_impl to construct a certificate resource from a | 48 // Used by tcp_socket_shared_impl to construct a certificate resource from a |
| 47 // server certificate. This object owns the pointer passed in. | 49 // server certificate. This object owns the pointer passed in. |
| 48 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, | 50 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| 49 PP_Instance instance, | 51 PP_Instance instance, |
| 50 PPB_X509Certificate_Fields* fields); | 52 const PPB_X509Certificate_Fields& fields); |
| 51 virtual ~PPB_Flash_X509Certificate_Shared(); | 53 virtual ~PPB_Flash_X509Certificate_Shared(); |
| 52 | 54 |
| 53 // Resource overrides. | 55 // Resource overrides. |
| 54 virtual PPB_Flash_X509Certificate_API* | 56 virtual PPB_Flash_X509Certificate_API* |
| 55 AsPPB_Flash_X509Certificate_API() OVERRIDE; | 57 AsPPB_Flash_X509Certificate_API() OVERRIDE; |
| 56 | 58 |
| 57 // PPB_Flash_X509Certificate_API implementation. | 59 // PPB_Flash_X509Certificate_API implementation. |
| 58 virtual PP_Bool Init(const char* bytes, uint32_t length) OVERRIDE; | 60 virtual PP_Bool Init(const char* bytes, uint32_t length) OVERRIDE; |
| 59 virtual PP_Var GetField(PP_Flash_X509Certificate_Field field) OVERRIDE; | 61 virtual PP_Var GetField(PP_Flash_X509Certificate_Field field) OVERRIDE; |
| 60 | 62 |
| 61 protected: | 63 protected: |
| 62 virtual bool ParseDER(const std::vector<char>& der, | 64 virtual bool ParseDER(const std::vector<char>& der, |
| 63 PPB_X509Certificate_Fields* result); | 65 PPB_X509Certificate_Fields* result); |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 scoped_ptr<PPB_X509Certificate_Fields> fields_; | 68 scoped_ptr<PPB_X509Certificate_Fields> fields_; |
| 67 | 69 |
| 68 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_X509Certificate_Shared); | 70 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_X509Certificate_Shared); |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 } // namespace ppapi | 73 } // namespace ppapi |
| 72 | 74 |
| 73 #endif // PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ | 75 #endif // PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ |
| OLD | NEW |