Home | History | Annotate | Download | only in nonsfi
      1 // Copyright 2014 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 COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_
      6 #define COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_
      7 
      8 #include "base/macros.h"
      9 
     10 #include "base/memory/ref_counted.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "base/synchronization/waitable_event.h"
     13 #include "base/threading/thread.h"
     14 #include "ipc/ipc_listener.h"
     15 
     16 namespace IPC {
     17 class Message;
     18 class SyncChannel;
     19 }  // namespace IPC
     20 
     21 class NaClTrustedListener;
     22 
     23 namespace nacl {
     24 
     25 struct NaClStartParams;
     26 
     27 namespace nonsfi {
     28 
     29 class NonSfiListener : public IPC::Listener {
     30  public:
     31   NonSfiListener();
     32   virtual ~NonSfiListener();
     33 
     34   // Listen for a request to launch a non-SFI NaCl module.
     35   void Listen();
     36   bool Send(IPC::Message* msg);
     37 
     38  private:
     39   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
     40   void OnStart(const nacl::NaClStartParams& params);
     41 
     42   base::Thread io_thread_;
     43   base::WaitableEvent shutdown_event_;
     44   scoped_ptr<IPC::SyncChannel> channel_;
     45   scoped_refptr<NaClTrustedListener> trusted_listener_;
     46 
     47   DISALLOW_COPY_AND_ASSIGN(NonSfiListener);
     48 };
     49 
     50 }  // namespace nonsfi
     51 }  // namespace nacl
     52 
     53 #endif  // COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_
     54