OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ | 5 #ifndef CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ |
6 #define CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ | 6 #define CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ipc/ipc_listener.h" | 11 #include "ipc/ipc_listener.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class Thread; | 14 class Thread; |
15 } // base | 15 } // base |
16 | 16 |
17 namespace IPC { | 17 namespace IPC { |
18 class Channel; | 18 class Channel; |
19 } // IPC | 19 } // IPC |
20 | 20 |
21 // Simple IPC listener to run on service side to collect service environment and | 21 // Simple IPC listener to run on service side to collect service environment and |
22 // to send back to setup utility. | 22 // to send back to setup utility. |
23 class ServiceListener : public IPC::Listener { | 23 class ServiceListener : public IPC::Listener { |
24 public: | 24 public: |
25 explicit ServiceListener(const base::FilePath& user_data_dir); | 25 explicit ServiceListener(const base::FilePath& user_data_dir); |
26 virtual ~ServiceListener(); | 26 ~ServiceListener() override; |
27 | 27 |
28 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 28 bool OnMessageReceived(const IPC::Message& msg) override; |
29 virtual void OnChannelConnected(int32 peer_pid) override; | 29 void OnChannelConnected(int32 peer_pid) override; |
30 | 30 |
31 private: | 31 private: |
32 void Disconnect(); | 32 void Disconnect(); |
33 void Connect(); | 33 void Connect(); |
34 | 34 |
35 scoped_ptr<base::Thread> ipc_thread_; | 35 scoped_ptr<base::Thread> ipc_thread_; |
36 scoped_ptr<IPC::Channel> channel_; | 36 scoped_ptr<IPC::Channel> channel_; |
37 base::FilePath user_data_dir_; | 37 base::FilePath user_data_dir_; |
38 }; | 38 }; |
39 | 39 |
40 #endif // CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ | 40 #endif // CLOUD_PRINT_SERVICE_SERVICE_LISTENER_H_ |
41 | 41 |
OLD | NEW |