OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_SERVICE_SERVICE_IPC_SERVER_H_ | 5 #ifndef CHROME_SERVICE_SERVICE_IPC_SERVER_H_ |
6 #define CHROME_SERVICE_SERVICE_IPC_SERVER_H_ | 6 #define CHROME_SERVICE_SERVICE_IPC_SERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ipc/ipc_channel_handle.h" | 12 #include "ipc/ipc_channel_handle.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ipc/ipc_sync_channel.h" | 14 #include "ipc/ipc_sync_channel.h" |
15 #include "ipc/ipc_sync_message_filter.h" | 15 #include "ipc/ipc_sync_message_filter.h" |
16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
17 | 17 |
| 18 namespace base { |
| 19 |
| 20 class DictionaryValue; |
| 21 |
| 22 } // namespace base |
| 23 |
18 // This class handles IPC commands for the service process. | 24 // This class handles IPC commands for the service process. |
19 class ServiceIPCServer : public IPC::Listener, public IPC::Sender { | 25 class ServiceIPCServer : public IPC::Listener, public IPC::Sender { |
20 public: | 26 public: |
21 explicit ServiceIPCServer(const IPC::ChannelHandle& handle); | 27 explicit ServiceIPCServer(const IPC::ChannelHandle& handle); |
22 virtual ~ServiceIPCServer(); | 28 virtual ~ServiceIPCServer(); |
23 | 29 |
24 bool Init(); | 30 bool Init(); |
25 | 31 |
26 // IPC::Sender implementation. | 32 // IPC::Sender implementation. |
27 virtual bool Send(IPC::Message* msg) OVERRIDE; | 33 virtual bool Send(IPC::Message* msg) OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
42 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 48 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
43 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 49 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
44 virtual void OnChannelError() OVERRIDE; | 50 virtual void OnChannelError() OVERRIDE; |
45 | 51 |
46 // IPC message handlers. | 52 // IPC message handlers. |
47 void OnEnableCloudPrintProxy(const std::string& lsid); | 53 void OnEnableCloudPrintProxy(const std::string& lsid); |
48 void OnEnableCloudPrintProxyWithRobot( | 54 void OnEnableCloudPrintProxyWithRobot( |
49 const std::string& robot_auth_code, | 55 const std::string& robot_auth_code, |
50 const std::string& robot_email, | 56 const std::string& robot_email, |
51 const std::string& user_email, | 57 const std::string& user_email, |
52 bool connect_new_printers, | 58 const base::DictionaryValue& user_settings); |
53 const std::vector<std::string>& printer_blacklist); | |
54 void OnGetCloudPrintProxyInfo(); | 59 void OnGetCloudPrintProxyInfo(); |
55 void OnDisableCloudPrintProxy(); | 60 void OnDisableCloudPrintProxy(); |
56 | 61 |
57 void OnShutdown(); | 62 void OnShutdown(); |
58 void OnUpdateAvailable(); | 63 void OnUpdateAvailable(); |
59 | 64 |
60 // Helper method to create the sync channel. | 65 // Helper method to create the sync channel. |
61 void CreateChannel(); | 66 void CreateChannel(); |
62 | 67 |
63 IPC::ChannelHandle channel_handle_; | 68 IPC::ChannelHandle channel_handle_; |
64 scoped_ptr<IPC::SyncChannel> channel_; | 69 scoped_ptr<IPC::SyncChannel> channel_; |
65 // Indicates whether a client is currently connected to the channel. | 70 // Indicates whether a client is currently connected to the channel. |
66 bool client_connected_; | 71 bool client_connected_; |
67 | 72 |
68 // Allows threads other than the main thread to send sync messages. | 73 // Allows threads other than the main thread to send sync messages. |
69 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; | 74 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
70 | 75 |
71 | 76 |
72 DISALLOW_COPY_AND_ASSIGN(ServiceIPCServer); | 77 DISALLOW_COPY_AND_ASSIGN(ServiceIPCServer); |
73 }; | 78 }; |
74 | 79 |
75 #endif // CHROME_SERVICE_SERVICE_IPC_SERVER_H_ | 80 #endif // CHROME_SERVICE_SERVICE_IPC_SERVER_H_ |
OLD | NEW |