| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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 "ppapi/c/private/ppb_flash_x509_certificate.h" |
| 12 #include "ppapi/shared_impl/resource.h" |
| 13 #include "ppapi/shared_impl/tracked_callback.h" |
| 14 #include "ppapi/thunk/ppb_flash_x509_certificate_api.h" |
| 15 |
| 16 namespace IPC { |
| 17 class Message; |
| 18 } |
| 19 |
| 20 namespace ppapi { |
| 21 namespace proxy { |
| 22 class Dispatcher; |
| 23 } |
| 24 } |
| 25 |
| 26 namespace pp { |
| 27 class Var; |
| 28 } |
| 29 |
| 30 namespace ppapi { |
| 31 |
| 32 class PPB_X509Certificate_Fields { |
| 33 public: |
| 34 PPB_X509Certificate_Fields(); |
| 35 virtual ~PPB_X509Certificate_Fields(); |
| 36 pp::Var& operator[](const PP_Flash_X509Certificate_Field field); |
| 37 |
| 38 // Implementation for IPC::ParamTraits<SerializedVar>. |
| 39 void WriteToMessage(IPC::Message* m) const; |
| 40 bool ReadFromMessage(const IPC::Message* m, void** iter); |
| 41 |
| 42 private: |
| 43 std::vector<pp::Var> data_; |
| 44 |
| 45 }; |
| 46 |
| 47 class PPAPI_SHARED_EXPORT PPB_Flash_X509Certificate_Shared |
| 48 : public thunk::PPB_Flash_X509Certificate_API, |
| 49 public Resource { |
| 50 public: |
| 51 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| 52 PP_Instance instance); |
| 53 // Used by tcp socket shared impl to construct a certificate |
| 54 // resource from a server certificate. |
| 55 PPB_Flash_X509Certificate_Shared(ResourceObjectType type, |
| 56 PP_Instance instance, |
| 57 const PPB_X509Certificate_Fields& fields); |
| 58 virtual ~PPB_Flash_X509Certificate_Shared(); |
| 59 |
| 60 // Resource overrides. |
| 61 virtual PPB_Flash_X509Certificate_API* |
| 62 AsPPB_Flash_X509Certificate_API() OVERRIDE; |
| 63 |
| 64 // PPB_Flash_X509Certificate_API implementation. |
| 65 virtual PP_Bool Init(const char* bytes, |
| 66 uint32_t length) OVERRIDE; |
| 67 virtual PP_Var GetField(PP_Flash_X509Certificate_Field field) OVERRIDE; |
| 68 |
| 69 |
| 70 protected: |
| 71 virtual bool ParseDER(const std::vector<char>& der, |
| 72 PPB_X509Certificate_Fields* result); |
| 73 |
| 74 private: |
| 75 scoped_ptr<PPB_X509Certificate_Fields> fields_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_X509Certificate_Shared); |
| 78 }; |
| 79 |
| 80 } // namespace ppapi |
| 81 |
| 82 #endif // PPAPI_SHARED_IMPL_PRIVATE_FLASH_X509_CERTIFICATE_IMPL_H_ |
| OLD | NEW |