| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
| 17 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest
.h" | 17 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest
.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 #if defined(OS_WIN) |
| 27 // Name of the command line switch used to pass handle of the native view to | 28 // Name of the command line switch used to pass handle of the native view to |
| 28 // the native messaging host. | 29 // the native messaging host. |
| 29 const char kParentWindowSwitchName[] = "parent-window"; | 30 const char kParentWindowSwitchName[] = "parent-window"; |
| 31 #endif // defined(OS_WIN) |
| 30 | 32 |
| 31 base::FilePath GetHostManifestPathFromCommandLine( | 33 base::FilePath GetHostManifestPathFromCommandLine( |
| 32 const std::string& native_host_name) { | 34 const std::string& native_host_name) { |
| 33 const std::string& value = | 35 const std::string& value = |
| 34 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 36 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 35 switches::kNativeMessagingHosts); | 37 switches::kNativeMessagingHosts); |
| 36 if (value.empty()) | 38 if (value.empty()) |
| 37 return base::FilePath(); | 39 return base::FilePath(); |
| 38 | 40 |
| 39 std::vector<std::string> hosts; | 41 std::vector<std::string> hosts; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } // namespace | 265 } // namespace |
| 264 | 266 |
| 265 // static | 267 // static |
| 266 scoped_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault( | 268 scoped_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault( |
| 267 gfx::NativeView native_view) { | 269 gfx::NativeView native_view) { |
| 268 return scoped_ptr<NativeProcessLauncher>( | 270 return scoped_ptr<NativeProcessLauncher>( |
| 269 new NativeProcessLauncherImpl(native_view)); | 271 new NativeProcessLauncherImpl(native_view)); |
| 270 } | 272 } |
| 271 | 273 |
| 272 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |