Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 void ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { |
| 81 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) | 81 IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) |
| 82 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, | 82 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, |
| 83 OnEnableCloudPrintProxy) | 83 OnEnableCloudPrintProxy) |
| 84 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, | 84 IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxyWithTokens, |
| 85 OnEnableCloudPrintProxyWithTokens) | 85 OnEnableCloudPrintProxyWithTokens) |
| 86 IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingWithTokens, | |
| 87 OnEnableRemotingWithTokens) | |
| 88 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, | 86 IPC_MESSAGE_HANDLER(ServiceMsg_DisableCloudPrintProxy, |
| 89 OnDisableCloudPrintProxy) | 87 OnDisableCloudPrintProxy) |
| 90 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, | 88 IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, |
| 91 OnIsCloudPrintProxyEnabled) | 89 OnIsCloudPrintProxyEnabled) |
| 90 IPC_MESSAGE_HANDLER(ServiceMsg_SetChromotingHostCredentials, | |
|
Alpha Left Google
2010/12/16 21:32:44
Use ifdef here.
Sergey Ulanov
2010/12/17 00:05:43
Done.
| |
| 91 OnSetChromotingHostCredentials) | |
| 92 IPC_MESSAGE_HANDLER(ServiceMsg_EnableChromotingHost, | |
| 93 OnEnableChromotingHost) | |
| 94 IPC_MESSAGE_HANDLER(ServiceMsg_DisableChromotingHost, | |
| 95 OnDisableChromotingHost) | |
| 96 IPC_MESSAGE_HANDLER(ServiceMsg_GetChromotingHostInfo, | |
| 97 OnGetChromotingHostInfo) | |
| 92 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); | 98 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); |
| 93 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); | 99 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); |
| 94 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); | 100 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); |
| 95 IPC_END_MESSAGE_MAP() | 101 IPC_END_MESSAGE_MAP() |
| 96 } | 102 } |
| 97 | 103 |
| 98 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { | 104 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { |
| 99 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); | 105 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); |
| 100 } | 106 } |
| 101 | 107 |
| 102 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( | 108 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( |
| 103 const std::string& cloud_print_token, const std::string& talk_token) { | 109 const std::string& cloud_print_token, const std::string& talk_token) { |
| 104 // TODO(sanjeevr): Implement this. | 110 // TODO(sanjeevr): Implement this. |
| 105 NOTIMPLEMENTED(); | 111 NOTIMPLEMENTED(); |
| 106 } | 112 } |
| 107 | 113 |
| 108 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { | 114 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { |
| 109 std::string email; | 115 std::string email; |
| 110 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); | 116 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); |
| 111 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, | 117 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, |
| 112 email)); | 118 email)); |
| 113 } | 119 } |
| 114 | 120 |
| 115 void ServiceIPCServer::OnEnableRemotingWithTokens( | 121 void ServiceIPCServer::OnSetChromotingHostCredentials( |
| 116 const std::string& login, | 122 const std::string& login, |
| 117 const std::string& remoting_token, | 123 const std::string& auth_token) { |
| 118 const std::string& talk_token) { | |
| 119 #if defined(ENABLE_REMOTING) | 124 #if defined(ENABLE_REMOTING) |
|
Alpha Left Google
2010/12/16 21:32:44
Use one ifdef to include there all.
Sergey Ulanov
2010/12/17 00:05:43
Done.
| |
| 120 g_service_process->EnableChromotingHostWithTokens(login, remoting_token, | 125 g_service_process->chromoting_host_manager()->SetCredentials( |
| 121 talk_token); | 126 login, auth_token); |
| 122 #endif | 127 #endif |
| 123 } | 128 } |
| 124 | 129 |
| 130 void ServiceIPCServer::OnEnableChromotingHost() { | |
| 131 #if defined(ENABLE_REMOTING) | |
| 132 g_service_process->chromoting_host_manager()->Enable(); | |
| 133 #endif | |
| 134 } | |
| 135 | |
| 136 void ServiceIPCServer:: OnDisableChromotingHost() { | |
| 137 #if defined(ENABLE_REMOTING) | |
| 138 g_service_process->chromoting_host_manager()->Disable(); | |
| 139 #endif | |
| 140 } | |
| 141 | |
| 142 void ServiceIPCServer:: OnGetChromotingHostInfo() { | |
| 143 #if defined(ENABLE_REMOTING) | |
| 144 remoting::ChromotingHostInfo host_info; | |
| 145 g_service_process->chromoting_host_manager()->GetHostInfo(&host_info); | |
| 146 channel_->Send(new ServiceHostMsg_ChromotingHost_HostInfo(host_info)); | |
| 147 #endif | |
| 148 } | |
| 149 | |
| 125 void ServiceIPCServer::OnDisableCloudPrintProxy() { | 150 void ServiceIPCServer::OnDisableCloudPrintProxy() { |
| 126 g_service_process->GetCloudPrintProxy()->DisableForUser(); | 151 g_service_process->GetCloudPrintProxy()->DisableForUser(); |
| 127 } | 152 } |
| 128 | 153 |
| 129 void ServiceIPCServer::OnHello() { | 154 void ServiceIPCServer::OnHello() { |
| 130 channel_->Send(new ServiceHostMsg_GoodDay()); | 155 channel_->Send(new ServiceHostMsg_GoodDay()); |
| 131 } | 156 } |
| 132 | 157 |
| 133 void ServiceIPCServer::OnShutdown() { | 158 void ServiceIPCServer::OnShutdown() { |
| 134 g_service_process->Shutdown(); | 159 g_service_process->Shutdown(); |
| 135 } | 160 } |
| 136 | 161 |
| 137 void ServiceIPCServer::OnUpdateAvailable() { | 162 void ServiceIPCServer::OnUpdateAvailable() { |
| 138 g_service_process->SetUpdateAvailable(); | 163 g_service_process->SetUpdateAvailable(); |
| 139 } | 164 } |
| 140 | |
| OLD | NEW |