-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process/launch.h"
+#include "chrome/common/chrome_switches.h"
namespace {
base::CommandLine chrome_command_line(chrome_dir.Append(kChromeExecutable));
// Forward all command line arguments.
- const std::vector<base::string16>& argv =
+ const std::vector<std::wstring>& argv =
base::CommandLine::ForCurrentProcess()->argv();
// The first one is always the current executable path.
CHECK(argv.size() > 0);
for (size_t i = 1; i < argv.size(); ++i)
chrome_command_line.AppendArgNative(argv[i]);
+ // Pass to Chrome the path of the shortcut, if any, that launched
+ // chrome_proxy.exe. This is used to record LaunchMode metrics.
+ STARTUPINFOW si = {sizeof(si)};
+ ::GetStartupInfoW(&si);
+ if (si.dwFlags & STARTF_TITLEISLINKNAME) {
+ chrome_command_line.AppendSwitchNative(switches::kSourceShortcut,
+ si.lpTitle);
+ }
+
base::LaunchOptions launch_options;
launch_options.current_directory = chrome_dir;
launch_options.grant_foreground_privilege = true;