Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1704)

Unified Diff: chrome/browser/extensions/api/messaging/native_process_launcher.cc

Issue 2271143002: Ensure/document that the first parameter to the native messaging host is the origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify parameters on Windows Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/docs/templates/articles/nativeMessaging.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/messaging/native_process_launcher.cc
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.cc b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
index f297d98996735baaac827ef9e1a2dae5c77b2893..e5ceaffe0418ec84e40e47a84ba38156c37b1f00 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
@@ -13,8 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
+#include "base/strings/stringprintf.h"
#include "base/threading/sequenced_worker_pool.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h"
@@ -30,12 +29,6 @@ namespace extensions {
namespace {
-#if defined(OS_WIN)
-// Name of the command line switch used to pass handle of the native view to
-// the native messaging host.
-const char kParentWindowSwitchName[] = "parent-window";
-#endif // defined(OS_WIN)
-
// Default implementation on NativeProcessLauncher interface.
class NativeProcessLauncherImpl : public NativeProcessLauncher {
public:
@@ -190,13 +183,16 @@ void NativeProcessLauncherImpl::Core::DoLaunchOnThreadPool(
}
base::CommandLine command_line(host_path);
+ // Note: The origin must be the first argument, so do not use AppendSwitch*
+ // hereafter because CommandLine inserts these switches before the other
+ // arguments.
command_line.AppendArg(origin.spec());
// Pass handle of the native view window to the native messaging host. This
// way the host will be able to create properly focused UI windows.
#if defined(OS_WIN)
- command_line.AppendSwitchASCII(kParentWindowSwitchName,
- base::Int64ToString(window_handle_));
+ command_line.AppendArg(
+ base::StringPrintf("--parent-window=%d", window_handle_));
#endif // !defined(OS_WIN)
base::Process process;
« no previous file with comments | « no previous file | chrome/common/extensions/docs/templates/articles/nativeMessaging.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698