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 CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PORT_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PORT_H_ 7 8 #include "chrome/browser/extensions/api/messaging/message_service.h" 9 10 namespace extensions { 11 class NativeMessageProcessHost; 12 13 // A port that manages communication with a native application. 14 class NativeMessagePort : public MessageService::MessagePort { 15 public: 16 // Takes ownership of |native_process|. 17 explicit NativeMessagePort(NativeMessageProcessHost* native_process); 18 virtual ~NativeMessagePort(); 19 virtual void DispatchOnMessage(const Message& message, 20 int target_port_id) OVERRIDE; 21 22 private: 23 NativeMessageProcessHost* native_process_; 24 }; 25 26 } // namespace extensions 27 28 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PORT_H_ 29