| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cloud_print/service/win/service_listener.h" | 5 #include "cloud_print/service/win/service_listener.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 channel_.reset(); | 84 channel_.reset(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ServiceListener::Connect() { | 87 void ServiceListener::Connect() { |
| 88 base::win::ScopedHandle handle( | 88 base::win::ScopedHandle handle( |
| 89 ::CreateFile(SetupListener::kSetupPipeName, GENERIC_READ | GENERIC_WRITE, | 89 ::CreateFile(SetupListener::kSetupPipeName, GENERIC_READ | GENERIC_WRITE, |
| 90 0, NULL, OPEN_EXISTING, | 90 0, NULL, OPEN_EXISTING, |
| 91 SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION | | 91 SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION | |
| 92 FILE_FLAG_OVERLAPPED, NULL)); | 92 FILE_FLAG_OVERLAPPED, NULL)); |
| 93 if (handle.IsValid()) { | 93 if (handle.IsValid()) { |
| 94 channel_.reset(new IPC::Channel(IPC::ChannelHandle(handle), | 94 channel_ = IPC::Channel::CreateClient(IPC::ChannelHandle(handle), |
| 95 IPC::Channel::MODE_CLIENT, this)); | 95 this); |
| 96 channel_->Connect(); | 96 channel_->Connect(); |
| 97 } else { | 97 } else { |
| 98 ipc_thread_->message_loop()->PostDelayedTask( | 98 ipc_thread_->message_loop()->PostDelayedTask( |
| 99 FROM_HERE, | 99 FROM_HERE, |
| 100 base::Bind(&ServiceListener::Connect, base::Unretained(this)), | 100 base::Bind(&ServiceListener::Connect, base::Unretained(this)), |
| 101 base::TimeDelta::FromMilliseconds(500)); | 101 base::TimeDelta::FromMilliseconds(500)); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| OLD | NEW |