Home | History | Annotate | Download | only in proxy
      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 #include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
      6 
      7 #include "ppapi/c/private/ppb_x509_certificate_private.h"
      8 #include "ppapi/proxy/plugin_globals.h"
      9 #include "ppapi/proxy/ppapi_messages.h"
     10 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
     11 
     12 namespace ppapi {
     13 namespace proxy {
     14 
     15 namespace {
     16 
     17 class X509CertificatePrivate : public PPB_X509Certificate_Private_Shared {
     18  public:
     19   X509CertificatePrivate(PP_Instance instance);
     20   virtual ~X509CertificatePrivate();
     21 
     22   virtual bool ParseDER(const std::vector<char>& der,
     23                         PPB_X509Certificate_Fields* result) OVERRIDE;
     24 
     25  private:
     26   void SendToBrowser(IPC::Message* msg);
     27 
     28   DISALLOW_COPY_AND_ASSIGN(X509CertificatePrivate);
     29 };
     30 
     31 X509CertificatePrivate::X509CertificatePrivate(PP_Instance instance)
     32     : PPB_X509Certificate_Private_Shared(OBJECT_IS_PROXY, instance) {
     33 }
     34 
     35 X509CertificatePrivate::~X509CertificatePrivate() {
     36 }
     37 
     38 bool X509CertificatePrivate::ParseDER(const std::vector<char>& der,
     39                                       PPB_X509Certificate_Fields* result) {
     40   bool succeeded = false;
     41   SendToBrowser(
     42       new PpapiHostMsg_PPBX509Certificate_ParseDER(der, &succeeded, result));
     43   return succeeded;
     44 }
     45 
     46 void X509CertificatePrivate::SendToBrowser(IPC::Message* msg) {
     47   PluginGlobals::Get()->GetBrowserSender()->Send(msg);
     48 }
     49 
     50 }  // namespace
     51 
     52 //------------------------------------------------------------------------------
     53 
     54 PPB_X509Certificate_Private_Proxy::PPB_X509Certificate_Private_Proxy(
     55     Dispatcher* dispatcher)
     56     : InterfaceProxy(dispatcher) {
     57 }
     58 
     59 PPB_X509Certificate_Private_Proxy::~PPB_X509Certificate_Private_Proxy() {
     60 }
     61 
     62 // static
     63 PP_Resource PPB_X509Certificate_Private_Proxy::CreateProxyResource(
     64     PP_Instance instance) {
     65   return (new X509CertificatePrivate(instance))->GetReference();
     66 }
     67 
     68 bool PPB_X509Certificate_Private_Proxy::OnMessageReceived(
     69     const IPC::Message& msg) {
     70   return false;
     71 }
     72 
     73 }  // namespace proxy
     74 }  // namespace ppapi
     75