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" |
11 | 11 |
12 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) | 12 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) |
13 : channel_handle_(channel_handle), client_connected_(false) { | 13 : channel_handle_(channel_handle), client_connected_(false) { |
14 } | 14 } |
15 | 15 |
16 bool ServiceIPCServer::Init() { | 16 bool ServiceIPCServer::Init() { |
17 #ifdef IPC_MESSAGE_LOG_ENABLED | 17 #ifdef IPC_MESSAGE_LOG_ENABLED |
18 IPC::Logging::GetInstance()->SetIPCSender(this); | 18 IPC::Logging::GetInstance()->SetIPCSender(this); |
19 #endif | 19 #endif |
20 sync_message_filter_ = | 20 sync_message_filter_ = |
21 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); | 21 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); |
22 CreateChannel(); | 22 CreateChannel(); |
23 return true; | 23 return true; |
24 } | 24 } |
25 | 25 |
26 void ServiceIPCServer::CreateChannel() { | 26 void ServiceIPCServer::CreateChannel() { |
27 channel_.reset(NULL); // Tear down the existing channel, if any. | 27 channel_.reset(NULL); // Tear down the existing channel, if any. |
28 channel_.reset(new IPC::SyncChannel(channel_handle_, | 28 channel_.reset(new IPC::SyncChannel(channel_handle_, |
29 IPC::Channel::MODE_NAMED_SERVER, this, | 29 IPC::Channel::MODE_NAMED_SERVER, this, |
30 g_service_process->io_thread()->message_loop(), true, | 30 g_service_process->io_thread()->message_loop_proxy(), true, |
31 g_service_process->shutdown_event())); | 31 g_service_process->shutdown_event())); |
32 DCHECK(sync_message_filter_.get()); | 32 DCHECK(sync_message_filter_.get()); |
33 channel_->AddFilter(sync_message_filter_.get()); | 33 channel_->AddFilter(sync_message_filter_.get()); |
34 } | 34 } |
35 | 35 |
36 ServiceIPCServer::~ServiceIPCServer() { | 36 ServiceIPCServer::~ServiceIPCServer() { |
37 #ifdef IPC_MESSAGE_LOG_ENABLED | 37 #ifdef IPC_MESSAGE_LOG_ENABLED |
38 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 38 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
39 #endif | 39 #endif |
40 | 40 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 g_service_process->GetCloudPrintProxy()->DisableForUser(); | 174 g_service_process->GetCloudPrintProxy()->DisableForUser(); |
175 } | 175 } |
176 | 176 |
177 void ServiceIPCServer::OnShutdown() { | 177 void ServiceIPCServer::OnShutdown() { |
178 g_service_process->Shutdown(); | 178 g_service_process->Shutdown(); |
179 } | 179 } |
180 | 180 |
181 void ServiceIPCServer::OnUpdateAvailable() { | 181 void ServiceIPCServer::OnUpdateAvailable() { |
182 g_service_process->SetUpdateAvailable(); | 182 g_service_process->SetUpdateAvailable(); |
183 } | 183 } |
OLD | NEW |