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 #if defined(ENABLE_REMOTING) |
| 91 IPC_MESSAGE_HANDLER(ServiceMsg_SetRemotingHostCredentials, |
| 92 OnSetRemotingHostCredentials) |
| 93 IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingHost, |
| 94 OnEnableRemotingHost) |
| 95 IPC_MESSAGE_HANDLER(ServiceMsg_DisableRemotingHost, |
| 96 OnDisableRemotingHost) |
| 97 IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, |
| 98 OnGetRemotingHostInfo) |
| 99 #endif // defined(ENABLE_REMOTING) |
92 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); | 100 IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); |
93 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); | 101 IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); |
94 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); | 102 IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); |
95 IPC_END_MESSAGE_MAP() | 103 IPC_END_MESSAGE_MAP() |
96 } | 104 } |
97 | 105 |
98 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { | 106 void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { |
99 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); | 107 g_service_process->GetCloudPrintProxy()->EnableForUser(lsid); |
100 } | 108 } |
101 | 109 |
102 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( | 110 void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( |
103 const std::string& cloud_print_token, const std::string& talk_token) { | 111 const std::string& cloud_print_token, const std::string& talk_token) { |
104 // TODO(sanjeevr): Implement this. | 112 // TODO(sanjeevr): Implement this. |
105 NOTIMPLEMENTED(); | 113 NOTIMPLEMENTED(); |
106 } | 114 } |
107 | 115 |
108 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { | 116 void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { |
109 std::string email; | 117 std::string email; |
110 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); | 118 bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); |
111 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, | 119 channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, |
112 email)); | 120 email)); |
113 } | 121 } |
114 | 122 |
115 void ServiceIPCServer::OnEnableRemotingWithTokens( | 123 #if defined(ENABLE_REMOTING) |
| 124 void ServiceIPCServer::OnSetRemotingHostCredentials( |
116 const std::string& login, | 125 const std::string& login, |
117 const std::string& remoting_token, | 126 const std::string& auth_token) { |
118 const std::string& talk_token) { | 127 g_service_process->remoting_host_manager()->SetCredentials( |
119 #if defined(ENABLE_REMOTING) | 128 login, auth_token); |
120 g_service_process->EnableChromotingHostWithTokens(login, remoting_token, | |
121 talk_token); | |
122 #endif | |
123 } | 129 } |
124 | 130 |
| 131 void ServiceIPCServer::OnEnableRemotingHost() { |
| 132 g_service_process->remoting_host_manager()->Enable(); |
| 133 } |
| 134 |
| 135 void ServiceIPCServer:: OnDisableRemotingHost() { |
| 136 g_service_process->remoting_host_manager()->Disable(); |
| 137 } |
| 138 |
| 139 void ServiceIPCServer:: OnGetRemotingHostInfo() { |
| 140 remoting::ChromotingHostInfo host_info; |
| 141 g_service_process->remoting_host_manager()->GetHostInfo(&host_info); |
| 142 channel_->Send(new ServiceHostMsg_RemotingHost_HostInfo(host_info)); |
| 143 } |
| 144 #endif // defined(ENABLE_REMOTING) |
| 145 |
125 void ServiceIPCServer::OnDisableCloudPrintProxy() { | 146 void ServiceIPCServer::OnDisableCloudPrintProxy() { |
126 g_service_process->GetCloudPrintProxy()->DisableForUser(); | 147 g_service_process->GetCloudPrintProxy()->DisableForUser(); |
127 } | 148 } |
128 | 149 |
129 void ServiceIPCServer::OnHello() { | 150 void ServiceIPCServer::OnHello() { |
130 channel_->Send(new ServiceHostMsg_GoodDay()); | 151 channel_->Send(new ServiceHostMsg_GoodDay()); |
131 } | 152 } |
132 | 153 |
133 void ServiceIPCServer::OnShutdown() { | 154 void ServiceIPCServer::OnShutdown() { |
134 g_service_process->Shutdown(); | 155 g_service_process->Shutdown(); |
135 } | 156 } |
136 | 157 |
137 void ServiceIPCServer::OnUpdateAvailable() { | 158 void ServiceIPCServer::OnUpdateAvailable() { |
138 g_service_process->SetUpdateAvailable(); | 159 g_service_process->SetUpdateAvailable(); |
139 } | 160 } |
140 | |
OLD | NEW |