| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 bool ServiceIPCServer::Send(IPC::Message* msg) { | 71 bool ServiceIPCServer::Send(IPC::Message* msg) { |
| 72 if (!channel_.get()) { | 72 if (!channel_.get()) { |
| 73 delete msg; | 73 delete msg; |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 return channel_->Send(msg); | 77 return channel_->Send(msg); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { | 80 bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { |
| 81 bool handled = true; |
| 81 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) | 82 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) |
| 82 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, | 83 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, |
| 83 OnEnableCloudPrintProxy) | 84 OnEnableCloudPrintProxy) |
| 84 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, | 85 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, |
| 85 OnEnableCloudPrintProxyWithTokens) | 86 OnEnableCloudPrintProxyWithTokens) |
| 86 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, | 87 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, |
| 87 OnDisableCloudPrintProxy) | 88 OnDisableCloudPrintProxy) |
| 88 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, | 89 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, |
| 89 OnIsCloudPrintProxyEnabled) | 90 OnIsCloudPrintProxyEnabled) |
| 90 #if defined(ENABLE_REMOTING) | 91 #if defined(ENABLE_REMOTING) |
| 91 IPC_MESSAGE_HANDLER(ServiceMsg_SetRemotingHostCredentials, | 92 IPC_MESSAGE_HANDLER(ServiceMsg_SetRemotingHostCredentials, |
| 92 OnSetRemotingHostCredentials) | 93 OnSetRemotingHostCredentials) |
| 93 IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingHost, | 94 IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingHost, |
| 94 OnEnableRemotingHost) | 95 OnEnableRemotingHost) |
| 95 IPC_MESSAGE_HANDLER(ServiceMsg_DisableRemotingHost, | 96 IPC_MESSAGE_HANDLER(ServiceMsg_DisableRemotingHost, |
| 96 OnDisableRemotingHost) | 97 OnDisableRemotingHost) |
| 97 IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, | 98 IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, |
| 98 OnGetRemotingHostInfo) | 99 OnGetRemotingHostInfo) |
| 99 #endif // defined(ENABLE_REMOTING) | 100 #endif // defined(ENABLE_REMOTING) |
| 100 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); | 101 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); |
| 101 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); | 102 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); |
| 102 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); | 103 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); |
| 104 IPC_MESSAGE_UNHANDLED(handled = false) |
| 103 IPC_END_MESSAGE_MAP() | 105 IPC_END_MESSAGE_MAP() |
| 106 return handled; |
| 104 } | 107 } |
| 105 | 108 |
| 106 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { | 109 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { |
| 107 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); | 110 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); |
| 108 } | 111 } |
| 109 | 112 |
| 110 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( | 113 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( |
| 111 const std::string& cloud_print_token, const std::string& talk_token) { | 114 const std::string& cloud_print_token, const std::string& talk_token) { |
| 112 // TODO(sanjeevr): Implement this. | 115 // TODO(sanjeevr): Implement this. |
| 113 NOTIMPLEMENTED(); | 116 NOTIMPLEMENTED(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 channel_->Send(new ServiceHostMsg_GoodDay()); | 154 channel_->Send(new ServiceHostMsg_GoodDay()); |
| 152 } | 155 } |
| 153 | 156 |
| 154 void ServiceIPCServer::OnShutdown() { | 157 void ServiceIPCServer::OnShutdown() { |
| 155 g_service_process->Shutdown(); | 158 g_service_process->Shutdown(); |
| 156 } | 159 } |
| 157 | 160 |
| 158 void ServiceIPCServer::OnUpdateAvailable() { | 161 void ServiceIPCServer::OnUpdateAvailable() { |
| 159 g_service_process->SetUpdateAvailable(); | 162 g_service_process->SetUpdateAvailable(); |
| 160 } | 163 } |
| OLD | NEW |