summaryrefslogtreecommitdiffstats
path: root/chrome/app/chrome_watcher_command_line_win.h
blob: d4d4a97dba0b3e3ebf80b67c0302ed6e63225504 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_APP_CHROME_WATCHER_COMMAND_LINE_WIN_H_
#define CHROME_APP_CHROME_WATCHER_COMMAND_LINE_WIN_H_

#include <windows.h>

#include "base/win/scoped_handle.h"

namespace base {
class CommandLine;
class FilePath;
}  // namespace base

// Generates a CommandLine that will launch |chrome_exe| in Chrome Watcher mode
// to observe |parent_process|, whose main thread is identified by
// |main_thread_id|. The watcher process will signal |on_initialized_event| when
// its initialization is complete.
base::CommandLine GenerateChromeWatcherCommandLine(
    const base::FilePath& chrome_exe,
    HANDLE parent_process,
    DWORD main_thread_id,
    HANDLE on_initialized_event);

// Interprets the Command Line used to launch a Chrome Watcher process and
// extracts the parent process and initialization event HANDLEs and the parent
// process main thread ID. Verifies that the handles are usable in this process
// before returning them. Returns true if all parameters are successfully parsed
// and false otherwise. In case of partial failure, any successfully parsed
// HANDLEs will be closed.
bool InterpretChromeWatcherCommandLine(
    const base::CommandLine& command_line,
    base::win::ScopedHandle* parent_process,
    DWORD* main_thread_id,
    base::win::ScopedHandle* on_initialized_event);

#endif  // CHROME_APP_CHROME_WATCHER_COMMAND_LINE_WIN_H_