OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/metrics/histogram_delta_serialization.h" | 7 #include "base/metrics/histogram_delta_serialization.h" |
8 #include "chrome/common/service_messages.h" | 8 #include "chrome/common/service_messages.h" |
9 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 9 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
10 #include "chrome/service/service_process.h" | 10 #include "chrome/service/service_process.h" |
| 11 #include "ipc/attachment_broker.h" |
11 #include "ipc/ipc_logging.h" | 12 #include "ipc/ipc_logging.h" |
12 | 13 |
| 14 #if defined(OS_WIN) |
| 15 #include "ipc/attachment_broker_win.h" |
| 16 #endif |
| 17 |
13 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) | 18 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) |
14 : channel_handle_(channel_handle), client_connected_(false) { | 19 : channel_handle_(channel_handle), client_connected_(false) { |
15 } | 20 } |
16 | 21 |
17 bool ServiceIPCServer::Init() { | 22 bool ServiceIPCServer::Init() { |
18 #ifdef IPC_MESSAGE_LOG_ENABLED | 23 #ifdef IPC_MESSAGE_LOG_ENABLED |
19 IPC::Logging::GetInstance()->SetIPCSender(this); | 24 IPC::Logging::GetInstance()->SetIPCSender(this); |
20 #endif | 25 #endif |
21 sync_message_filter_ = | 26 sync_message_filter_ = |
22 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); | 27 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); |
| 28 #if defined(OS_WIN) |
| 29 attachment_broker_.reset(new IPC::AttachmentBrokerWin()); |
| 30 #endif |
23 CreateChannel(); | 31 CreateChannel(); |
24 return true; | 32 return true; |
25 } | 33 } |
26 | 34 |
27 void ServiceIPCServer::CreateChannel() { | 35 void ServiceIPCServer::CreateChannel() { |
28 channel_.reset(NULL); // Tear down the existing channel, if any. | 36 channel_.reset(NULL); // Tear down the existing channel, if any. |
29 channel_ = IPC::SyncChannel::Create( | 37 channel_ = IPC::SyncChannel::Create( |
30 channel_handle_, IPC::Channel::MODE_NAMED_SERVER, this, | 38 channel_handle_, IPC::Channel::MODE_NAMED_SERVER, this, |
31 g_service_process->io_thread()->task_runner().get(), true, | 39 g_service_process->io_thread()->task_runner().get(), true, |
32 g_service_process->shutdown_event()); | 40 g_service_process->shutdown_event(), attachment_broker_.get()); |
33 DCHECK(sync_message_filter_.get()); | 41 DCHECK(sync_message_filter_.get()); |
34 channel_->AddFilter(sync_message_filter_.get()); | 42 channel_->AddFilter(sync_message_filter_.get()); |
35 } | 43 } |
36 | 44 |
37 ServiceIPCServer::~ServiceIPCServer() { | 45 ServiceIPCServer::~ServiceIPCServer() { |
38 #ifdef IPC_MESSAGE_LOG_ENABLED | 46 #ifdef IPC_MESSAGE_LOG_ENABLED |
39 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 47 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
40 #endif | 48 #endif |
41 | 49 |
42 channel_->RemoveFilter(sync_message_filter_.get()); | 50 channel_->RemoveFilter(sync_message_filter_.get()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 152 } |
145 | 153 |
146 void ServiceIPCServer::OnShutdown() { | 154 void ServiceIPCServer::OnShutdown() { |
147 g_service_process->Shutdown(); | 155 g_service_process->Shutdown(); |
148 } | 156 } |
149 | 157 |
150 void ServiceIPCServer::OnUpdateAvailable() { | 158 void ServiceIPCServer::OnUpdateAvailable() { |
151 g_service_process->SetUpdateAvailable(); | 159 g_service_process->SetUpdateAvailable(); |
152 } | 160 } |
153 | 161 |
OLD | NEW |