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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 base::FilePath manifest_path = | 133 base::FilePath manifest_path = |
134 FindManifest(native_host_name, allow_user_level_hosts_, &error_message); | 134 FindManifest(native_host_name, allow_user_level_hosts_, &error_message); |
135 | 135 |
136 if (manifest_path.empty()) { | 136 if (manifest_path.empty()) { |
137 LOG(ERROR) << "Can't find manifest for native messaging host " | 137 LOG(ERROR) << "Can't find manifest for native messaging host " |
138 << native_host_name; | 138 << native_host_name; |
139 PostErrorResult(callback, RESULT_NOT_FOUND); | 139 PostErrorResult(callback, RESULT_NOT_FOUND); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 scoped_ptr<NativeMessagingHostManifest> manifest = | 143 std::unique_ptr<NativeMessagingHostManifest> manifest = |
144 NativeMessagingHostManifest::Load(manifest_path, &error_message); | 144 NativeMessagingHostManifest::Load(manifest_path, &error_message); |
145 | 145 |
146 if (!manifest) { | 146 if (!manifest) { |
147 LOG(ERROR) << "Failed to load manifest for native messaging host " | 147 LOG(ERROR) << "Failed to load manifest for native messaging host " |
148 << native_host_name << ": " << error_message; | 148 << native_host_name << ": " << error_message; |
149 PostErrorResult(callback, RESULT_NOT_FOUND); | 149 PostErrorResult(callback, RESULT_NOT_FOUND); |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 if (manifest->name() != native_host_name) { | 153 if (manifest->name() != native_host_name) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 void NativeProcessLauncherImpl::Launch(const GURL& origin, | 260 void NativeProcessLauncherImpl::Launch(const GURL& origin, |
261 const std::string& native_host_name, | 261 const std::string& native_host_name, |
262 const LaunchedCallback& callback) const { | 262 const LaunchedCallback& callback) const { |
263 core_->Launch(origin, native_host_name, callback); | 263 core_->Launch(origin, native_host_name, callback); |
264 } | 264 } |
265 | 265 |
266 } // namespace | 266 } // namespace |
267 | 267 |
268 // static | 268 // static |
269 scoped_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault( | 269 std::unique_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault( |
270 bool allow_user_level_hosts, | 270 bool allow_user_level_hosts, |
271 gfx::NativeView native_view) { | 271 gfx::NativeView native_view) { |
272 intptr_t window_handle = 0; | 272 intptr_t window_handle = 0; |
273 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
274 window_handle = reinterpret_cast<intptr_t>( | 274 window_handle = reinterpret_cast<intptr_t>( |
275 views::HWNDForNativeView(native_view)); | 275 views::HWNDForNativeView(native_view)); |
276 #endif | 276 #endif |
277 return scoped_ptr<NativeProcessLauncher>( | 277 return std::unique_ptr<NativeProcessLauncher>( |
278 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle)); | 278 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle)); |
279 } | 279 } |
280 | 280 |
281 } // namespace extensions | 281 } // namespace extensions |
OLD | NEW |