OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/service/service_ipc_server.h" | 5 #include "chrome/service/service_ipc_server.h" |
6 | 6 |
7 #include "chrome/common/service_messages.h" | 7 #include "chrome/common/service_messages.h" |
8 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 8 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
9 #include "chrome/service/service_process.h" | 9 #include "chrome/service/service_process.h" |
10 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
11 | 11 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 client_connected_ = true; | 100 client_connected_ = true; |
101 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) | 101 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) |
102 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, | 102 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, |
103 OnEnableCloudPrintProxy) | 103 OnEnableCloudPrintProxy) |
104 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, | 104 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, |
105 OnEnableCloudPrintProxyWithTokens) | 105 OnEnableCloudPrintProxyWithTokens) |
106 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, | 106 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, |
107 OnDisableCloudPrintProxy) | 107 OnDisableCloudPrintProxy) |
108 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, | 108 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, |
109 OnIsCloudPrintProxyEnabled) | 109 OnIsCloudPrintProxyEnabled) |
110 #if defined(ENABLE_REMOTING) | |
111 IPC_MESSAGE_HANDLER(ServiceMsg_SetRemotingHostCredentials, | |
112 OnSetRemotingHostCredentials) | |
113 IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingHost, | |
114 OnEnableRemotingHost) | |
115 IPC_MESSAGE_HANDLER(ServiceMsg_DisableRemotingHost, | |
116 OnDisableRemotingHost) | |
117 IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, | |
118 OnGetRemotingHostInfo) | |
119 #endif // defined(ENABLE_REMOTING) | |
120 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); | 110 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); |
121 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); | 111 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); |
122 IPC_MESSAGE_UNHANDLED(handled = false) | 112 IPC_MESSAGE_UNHANDLED(handled = false) |
123 IPC_END_MESSAGE_MAP() | 113 IPC_END_MESSAGE_MAP() |
124 return handled; | 114 return handled; |
125 } | 115 } |
126 | 116 |
127 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { | 117 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { |
128 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); | 118 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); |
129 } | 119 } |
130 | 120 |
131 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( | 121 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( |
132 const std::string& cloud_print_token, const std::string& talk_token) { | 122 const std::string& cloud_print_token, const std::string& talk_token) { |
133 // TODO(sanjeevr): Implement this. | 123 // TODO(sanjeevr): Implement this. |
134 NOTIMPLEMENTED(); | 124 NOTIMPLEMENTED(); |
135 } | 125 } |
136 | 126 |
137 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { | 127 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { |
138 std::string email; | 128 std::string email; |
139 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); | 129 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); |
140 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, | 130 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, |
141 email)); | 131 email)); |
142 } | 132 } |
143 | 133 |
144 #if defined(ENABLE_REMOTING) | |
145 void ServiceIPCServer::OnSetRemotingHostCredentials( | |
146 const std::string& login, | |
147 const std::string& auth_token) { | |
148 g_service_process->remoting_host_manager()->SetCredentials( | |
149 login, auth_token); | |
150 } | |
151 | |
152 void ServiceIPCServer::OnEnableRemotingHost() { | |
153 g_service_process->remoting_host_manager()->Enable(); | |
154 SendRemotingHostInfo(); | |
155 } | |
156 | |
157 void ServiceIPCServer::OnDisableRemotingHost() { | |
158 g_service_process->remoting_host_manager()->Disable(); | |
159 SendRemotingHostInfo(); | |
160 } | |
161 | |
162 void ServiceIPCServer::OnGetRemotingHostInfo() { | |
163 SendRemotingHostInfo(); | |
164 } | |
165 | |
166 void ServiceIPCServer::SendRemotingHostInfo() { | |
167 remoting::ChromotingHostInfo host_info; | |
168 g_service_process->remoting_host_manager()->GetHostInfo(&host_info); | |
169 channel_->Send(new ServiceHostMsg_RemotingHost_HostInfo(host_info)); | |
170 } | |
171 #endif // defined(ENABLE_REMOTING) | |
172 | |
173 void ServiceIPCServer::OnDisableCloudPrintProxy() { | 134 void ServiceIPCServer::OnDisableCloudPrintProxy() { |
174 g_service_process->GetCloudPrintProxy()->DisableForUser(); | 135 g_service_process->GetCloudPrintProxy()->DisableForUser(); |
175 } | 136 } |
176 | 137 |
177 void ServiceIPCServer::OnShutdown() { | 138 void ServiceIPCServer::OnShutdown() { |
178 g_service_process->Shutdown(); | 139 g_service_process->Shutdown(); |
179 } | 140 } |
180 | 141 |
181 void ServiceIPCServer::OnUpdateAvailable() { | 142 void ServiceIPCServer::OnUpdateAvailable() { |
182 g_service_process->SetUpdateAvailable(); | 143 g_service_process->SetUpdateAvailable(); |
183 } | 144 } |
OLD | NEW |