| 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/browser/extensions/api/messaging/native_process_launcher.h" | 5 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void NativeProcessLauncherImpl::Core::Detach() { | 101 void NativeProcessLauncherImpl::Core::Detach() { |
| 102 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 102 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 103 detached_ = true; | 103 detached_ = true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void NativeProcessLauncherImpl::Core::Launch( | 106 void NativeProcessLauncherImpl::Core::Launch( |
| 107 const GURL& origin, | 107 const GURL& origin, |
| 108 const std::string& native_host_name, | 108 const std::string& native_host_name, |
| 109 const LaunchedCallback& callback) { | 109 const LaunchedCallback& callback) { |
| 110 base::PostTaskWithTraits(FROM_HERE, | 110 base::PostTaskWithTraits(FROM_HERE, |
| 111 base::TaskTraits().MayBlock().WithPriority( | 111 {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, |
| 112 base::TaskPriority::USER_VISIBLE), | |
| 113 base::BindOnce(&Core::DoLaunchOnThreadPool, this, | 112 base::BindOnce(&Core::DoLaunchOnThreadPool, this, |
| 114 origin, native_host_name, callback)); | 113 origin, native_host_name, callback)); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void NativeProcessLauncherImpl::Core::DoLaunchOnThreadPool( | 116 void NativeProcessLauncherImpl::Core::DoLaunchOnThreadPool( |
| 118 const GURL& origin, | 117 const GURL& origin, |
| 119 const std::string& native_host_name, | 118 const std::string& native_host_name, |
| 120 const LaunchedCallback& callback) { | 119 const LaunchedCallback& callback) { |
| 121 if (!NativeMessagingHostManifest::IsValidName(native_host_name)) { | 120 if (!NativeMessagingHostManifest::IsValidName(native_host_name)) { |
| 122 PostErrorResult(callback, RESULT_INVALID_NAME); | 121 PostErrorResult(callback, RESULT_INVALID_NAME); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 intptr_t window_handle = 0; | 268 intptr_t window_handle = 0; |
| 270 #if defined(OS_WIN) | 269 #if defined(OS_WIN) |
| 271 window_handle = reinterpret_cast<intptr_t>( | 270 window_handle = reinterpret_cast<intptr_t>( |
| 272 views::HWNDForNativeView(native_view)); | 271 views::HWNDForNativeView(native_view)); |
| 273 #endif | 272 #endif |
| 274 return std::unique_ptr<NativeProcessLauncher>( | 273 return std::unique_ptr<NativeProcessLauncher>( |
| 275 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle)); | 274 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle)); |
| 276 } | 275 } |
| 277 | 276 |
| 278 } // namespace extensions | 277 } // namespace extensions |
| OLD | NEW |