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