| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 kBufferSize, | 585 kBufferSize, |
| 586 kTimeOutMilliseconds, | 586 kTimeOutMilliseconds, |
| 587 &security_attributes)); | 587 &security_attributes)); |
| 588 | 588 |
| 589 if (!delegate_read_handle.IsValid()) { | 589 if (!delegate_read_handle.IsValid()) { |
| 590 PLOG(ERROR) << "Failed to create named pipe '" << output_pipe_name << "'"; | 590 PLOG(ERROR) << "Failed to create named pipe '" << output_pipe_name << "'"; |
| 591 OnError(); | 591 OnError(); |
| 592 return; | 592 return; |
| 593 } | 593 } |
| 594 | 594 |
| 595 const CommandLine* current_command_line = CommandLine::ForCurrentProcess(); | 595 const base::CommandLine* current_command_line = |
| 596 const CommandLine::SwitchMap& switches = current_command_line->GetSwitches(); | 596 base::CommandLine::ForCurrentProcess(); |
| 597 CommandLine::StringVector args = current_command_line->GetArgs(); | 597 const base::CommandLine::SwitchMap& switches = |
| 598 current_command_line->GetSwitches(); |
| 599 base::CommandLine::StringVector args = current_command_line->GetArgs(); |
| 598 | 600 |
| 599 // Create the child process command line by copying switches from the current | 601 // Create the child process command line by copying switches from the current |
| 600 // command line. | 602 // command line. |
| 601 CommandLine command_line(CommandLine::NO_PROGRAM); | 603 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 602 command_line.AppendSwitch(kElevatingSwitchName); | 604 command_line.AppendSwitch(kElevatingSwitchName); |
| 603 command_line.AppendSwitchASCII(kInputSwitchName, input_pipe_name); | 605 command_line.AppendSwitchASCII(kInputSwitchName, input_pipe_name); |
| 604 command_line.AppendSwitchASCII(kOutputSwitchName, output_pipe_name); | 606 command_line.AppendSwitchASCII(kOutputSwitchName, output_pipe_name); |
| 605 | 607 |
| 606 DCHECK(!current_command_line->HasSwitch(kElevatingSwitchName)); | 608 DCHECK(!current_command_line->HasSwitch(kElevatingSwitchName)); |
| 607 for (CommandLine::SwitchMap::const_iterator i = switches.begin(); | 609 for (base::CommandLine::SwitchMap::const_iterator i = switches.begin(); |
| 608 i != switches.end(); ++i) { | 610 i != switches.end(); ++i) { |
| 609 command_line.AppendSwitchNative(i->first, i->second); | 611 command_line.AppendSwitchNative(i->first, i->second); |
| 610 } | 612 } |
| 611 for (CommandLine::StringVector::const_iterator i = args.begin(); | 613 for (base::CommandLine::StringVector::const_iterator i = args.begin(); |
| 612 i != args.end(); ++i) { | 614 i != args.end(); ++i) { |
| 613 command_line.AppendArgNative(*i); | 615 command_line.AppendArgNative(*i); |
| 614 } | 616 } |
| 615 | 617 |
| 616 // Get the name of the binary to launch. | 618 // Get the name of the binary to launch. |
| 617 base::FilePath binary = current_command_line->GetProgram(); | 619 base::FilePath binary = current_command_line->GetProgram(); |
| 618 CommandLine::StringType parameters = command_line.GetCommandLineString(); | 620 base::CommandLine::StringType parameters = |
| 621 command_line.GetCommandLineString(); |
| 619 | 622 |
| 620 // Launch the child process requesting elevation. | 623 // Launch the child process requesting elevation. |
| 621 SHELLEXECUTEINFO info; | 624 SHELLEXECUTEINFO info; |
| 622 memset(&info, 0, sizeof(info)); | 625 memset(&info, 0, sizeof(info)); |
| 623 info.cbSize = sizeof(info); | 626 info.cbSize = sizeof(info); |
| 624 info.hwnd = reinterpret_cast<HWND>(parent_window_handle_); | 627 info.hwnd = reinterpret_cast<HWND>(parent_window_handle_); |
| 625 info.lpVerb = L"runas"; | 628 info.lpVerb = L"runas"; |
| 626 info.lpFile = binary.value().c_str(); | 629 info.lpFile = binary.value().c_str(); |
| 627 info.lpParameters = parameters.c_str(); | 630 info.lpParameters = parameters.c_str(); |
| 628 info.nShow = SW_HIDE; | 631 info.nShow = SW_HIDE; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 691 |
| 689 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( | 692 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( |
| 690 scoped_ptr<base::DictionaryValue> message) { | 693 scoped_ptr<base::DictionaryValue> message) { |
| 691 NOTREACHED(); | 694 NOTREACHED(); |
| 692 return false; | 695 return false; |
| 693 } | 696 } |
| 694 | 697 |
| 695 #endif // !defined(OS_WIN) | 698 #endif // !defined(OS_WIN) |
| 696 | 699 |
| 697 } // namespace remoting | 700 } // namespace remoting |
| OLD | NEW |