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 "remoting/host/setup/me2me_native_messaging_host.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host.h" |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return result.Pass(); | 65 return result.Pass(); |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 namespace remoting { | 70 namespace remoting { |
71 | 71 |
72 Me2MeNativeMessagingHost::Me2MeNativeMessagingHost( | 72 Me2MeNativeMessagingHost::Me2MeNativeMessagingHost( |
73 bool needs_elevation, | 73 bool needs_elevation, |
74 intptr_t parent_window_handle, | 74 intptr_t parent_window_handle, |
75 scoped_ptr<NativeMessagingChannel> channel, | 75 scoped_ptr<extensions::NativeMessagingChannel> channel, |
76 scoped_refptr<DaemonController> daemon_controller, | 76 scoped_refptr<DaemonController> daemon_controller, |
77 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 77 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
78 scoped_ptr<OAuthClient> oauth_client) | 78 scoped_ptr<OAuthClient> oauth_client) |
79 : needs_elevation_(needs_elevation), | 79 : needs_elevation_(needs_elevation), |
80 parent_window_handle_(parent_window_handle), | 80 parent_window_handle_(parent_window_handle), |
81 channel_(channel.Pass()), | 81 channel_(channel.Pass()), |
82 daemon_controller_(daemon_controller), | 82 daemon_controller_(daemon_controller), |
83 pairing_registry_(pairing_registry), | 83 pairing_registry_(pairing_registry), |
84 oauth_client_(oauth_client.Pass()), | 84 oauth_client_(oauth_client.Pass()), |
85 weak_factory_(this) { | 85 weak_factory_(this) { |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 DWORD error = ::GetLastError(); | 652 DWORD error = ::GetLastError(); |
653 if (error != ERROR_PIPE_CONNECTED) { | 653 if (error != ERROR_PIPE_CONNECTED) { |
654 PLOG(ERROR) << "Unable to connect '" << output_pipe_name << "'"; | 654 PLOG(ERROR) << "Unable to connect '" << output_pipe_name << "'"; |
655 OnError(); | 655 OnError(); |
656 return; | 656 return; |
657 } | 657 } |
658 } | 658 } |
659 | 659 |
660 // Set up the native messaging channel to talk to the elevated host. | 660 // Set up the native messaging channel to talk to the elevated host. |
661 // Note that input for the elevate channel is output forthe elevated host. | 661 // Note that input for the elevate channel is output forthe elevated host. |
662 elevated_channel_.reset(new NativeMessagingChannel( | 662 elevated_channel_.reset(new PipeMessagingChannel( |
663 base::File(delegate_read_handle.Take()), | 663 base::File(delegate_read_handle.Take()), |
664 base::File(delegate_write_handle.Take()))); | 664 base::File(delegate_write_handle.Take()))); |
665 | 665 |
666 elevated_channel_->Start( | 666 elevated_channel_->Start( |
667 base::Bind(&Me2MeNativeMessagingHost::ProcessDelegateResponse, weak_ptr_), | 667 base::Bind(&Me2MeNativeMessagingHost::ProcessDelegateResponse, weak_ptr_), |
668 base::Bind(&Me2MeNativeMessagingHost::Stop, weak_ptr_)); | 668 base::Bind(&Me2MeNativeMessagingHost::Stop, weak_ptr_)); |
669 | 669 |
670 elevated_host_timer_.Start( | 670 elevated_host_timer_.Start( |
671 FROM_HERE, base::TimeDelta::FromSeconds(kElevatedHostTimeoutSeconds), | 671 FROM_HERE, base::TimeDelta::FromSeconds(kElevatedHostTimeoutSeconds), |
672 this, &Me2MeNativeMessagingHost::DisconnectElevatedHost); | 672 this, &Me2MeNativeMessagingHost::DisconnectElevatedHost); |
(...skipping 18 matching lines...) Expand all Loading... |
691 | 691 |
692 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( | 692 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( |
693 scoped_ptr<base::DictionaryValue> message) { | 693 scoped_ptr<base::DictionaryValue> message) { |
694 NOTREACHED(); | 694 NOTREACHED(); |
695 return false; | 695 return false; |
696 } | 696 } |
697 | 697 |
698 #endif // !defined(OS_WIN) | 698 #endif // !defined(OS_WIN) |
699 | 699 |
700 } // namespace remoting | 700 } // namespace remoting |
OLD | NEW |