• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "content/browser/renderer_host/pepper/pepper_message_filter.h"
6 
7 #include "base/logging.h"
8 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h"
9 #include "content/public/common/content_client.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11 
12 namespace content {
13 
PepperMessageFilter()14 PepperMessageFilter::PepperMessageFilter() {}
~PepperMessageFilter()15 PepperMessageFilter::~PepperMessageFilter() {}
16 
OnMessageReceived(const IPC::Message & msg,bool * message_was_ok)17 bool PepperMessageFilter::OnMessageReceived(const IPC::Message& msg,
18                                             bool* message_was_ok) {
19   bool handled = true;
20   IPC_BEGIN_MESSAGE_MAP_EX(PepperMessageFilter, msg, *message_was_ok)
21     // X509 certificate messages.
22     IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBX509Certificate_ParseDER,
23                         OnX509CertificateParseDER);
24 
25   IPC_MESSAGE_UNHANDLED(handled = false)
26   IPC_END_MESSAGE_MAP_EX()
27   return handled;
28 }
29 
OnX509CertificateParseDER(const std::vector<char> & der,bool * succeeded,ppapi::PPB_X509Certificate_Fields * result)30 void PepperMessageFilter::OnX509CertificateParseDER(
31     const std::vector<char>& der,
32     bool* succeeded,
33     ppapi::PPB_X509Certificate_Fields* result) {
34   *succeeded = (der.size() != 0 && pepper_socket_utils::GetCertificateFields(
35       &der[0], der.size(), result));
36 }
37 
38 }  // namespace content
39