1// Copyright 2013 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 CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ 6#define CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ 7 8#include "base/compiler_specific.h" 9#include "base/files/file_path.h" 10#include "base/memory/scoped_ptr.h" 11#include "ipc/ipc_listener.h" 12 13namespace base { 14class Thread; 15} // base 16 17namespace IPC { 18class Channel; 19} // IPC 20 21// Simple IPC listener to run on service side to collect service environment and 22// to send back to setup utility. 23class ServiceListener : public IPC::Listener { 24 public: 25 explicit ServiceListener(const base::FilePath& user_data_dir); 26 virtual ~ServiceListener(); 27 28 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 29 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 30 31 private: 32 void Disconnect(); 33 void Connect(); 34 35 scoped_ptr<base::Thread> ipc_thread_; 36 scoped_ptr<IPC::Channel> channel_; 37 base::FilePath user_data_dir_; 38}; 39 40#endif // CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ 41 42