| 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_main.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host_main.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/i18n/icu_util.h" | 9 #include "base/i18n/icu_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 86 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 87 | 87 |
| 88 base::MessageLoopForUI message_loop; | 88 base::MessageLoopForUI message_loop; |
| 89 base::RunLoop run_loop; | 89 base::RunLoop run_loop; |
| 90 | 90 |
| 91 scoped_refptr<DaemonController> daemon_controller = | 91 scoped_refptr<DaemonController> daemon_controller = |
| 92 DaemonController::Create(); | 92 DaemonController::Create(); |
| 93 | 93 |
| 94 // Pass handle of the native view to the controller so that the UAC prompts | 94 // Pass handle of the native view to the controller so that the UAC prompts |
| 95 // are focused properly. | 95 // are focused properly. |
| 96 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 96 const base::CommandLine* command_line = |
| 97 base::CommandLine::ForCurrentProcess(); |
| 97 int64 native_view_handle = 0; | 98 int64 native_view_handle = 0; |
| 98 if (command_line->HasSwitch(kParentWindowSwitchName)) { | 99 if (command_line->HasSwitch(kParentWindowSwitchName)) { |
| 99 std::string native_view = | 100 std::string native_view = |
| 100 command_line->GetSwitchValueASCII(kParentWindowSwitchName); | 101 command_line->GetSwitchValueASCII(kParentWindowSwitchName); |
| 101 if (base::StringToInt64(native_view, &native_view_handle)) { | 102 if (base::StringToInt64(native_view, &native_view_handle)) { |
| 102 daemon_controller->SetWindow(reinterpret_cast<void*>(native_view_handle)); | 103 daemon_controller->SetWindow(reinterpret_cast<void*>(native_view_handle)); |
| 103 } else { | 104 } else { |
| 104 LOG(WARNING) << "Invalid parameter value --" << kParentWindowSwitchName | 105 LOG(WARNING) << "Invalid parameter value --" << kParentWindowSwitchName |
| 105 << "=" << native_view; | 106 << "=" << native_view; |
| 106 } | 107 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 248 |
| 248 // Run the loop until channel is alive. | 249 // Run the loop until channel is alive. |
| 249 run_loop.Run(); | 250 run_loop.Run(); |
| 250 return kSuccessExitCode; | 251 return kSuccessExitCode; |
| 251 } | 252 } |
| 252 | 253 |
| 253 int Me2MeNativeMessagingHostMain(int argc, char** argv) { | 254 int Me2MeNativeMessagingHostMain(int argc, char** argv) { |
| 254 // This object instance is required by Chrome code (such as MessageLoop). | 255 // This object instance is required by Chrome code (such as MessageLoop). |
| 255 base::AtExitManager exit_manager; | 256 base::AtExitManager exit_manager; |
| 256 | 257 |
| 257 CommandLine::Init(argc, argv); | 258 base::CommandLine::Init(argc, argv); |
| 258 remoting::InitHostLogging(); | 259 remoting::InitHostLogging(); |
| 259 | 260 |
| 260 return StartMe2MeNativeMessagingHost(); | 261 return StartMe2MeNativeMessagingHost(); |
| 261 } | 262 } |
| 262 | 263 |
| 263 } // namespace remoting | 264 } // namespace remoting |
| OLD | NEW |