Remove srpcgen-diff test from scons
[chromium-blink-merge.git] / chrome_frame / chrome_launcher.h
blobda2540e3def7e5c200acd6d5758c4ec054fbb75e
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_FRAME_CHROME_LAUNCHER_H_
6 #define CHROME_FRAME_CHROME_LAUNCHER_H_
8 #include <string>
10 // arraysize macro shamelessly stolen from base\basictypes.h
11 template <typename T, size_t N>
12 char (&ArraySizeHelper(T (&array)[N]))[N];
14 #define arraysize(array) (sizeof(ArraySizeHelper(array)))
16 namespace chrome_launcher {
18 // The base name of the chrome_launcher.exe file.
19 extern const wchar_t kLauncherExeBaseName[];
21 // Returns true if command_line contains only flags that we allow through.
22 // Returns false if command_line contains any unrecognized flags.
23 bool IsValidCommandLine(const wchar_t* command_line);
25 // Given a command-line without an initial program part, launch our associated
26 // chrome.exe with a sanitized version of that command line. Returns true iff
27 // successful.
28 bool SanitizeAndLaunchChrome(const wchar_t* command_line);
30 // Returns a pointer to the position in command_line the string right after the
31 // name of the executable. This is equivalent to the second element of the
32 // array returned by CommandLineToArgvW. Returns NULL if there are no further
33 // arguments.
34 const wchar_t* GetArgumentsStart(const wchar_t* command_line);
36 // Returns the full path to the Chrome executable.
37 bool GetChromeExecutablePath(std::wstring* chrome_path);
39 // Returns whether a given argument is considered a valid flag. Only accepts
40 // flags of the forms:
41 // --foo
42 // --foo=bar
43 bool IsValidArgument(const std::wstring& argument);
45 // Returns a string that is equivalent in input_str without any leading
46 // or trailing whitespace. Returns an empty string if input_str contained only
47 // whitespace.
48 std::wstring TrimWhiteSpace(const wchar_t* input_str);
50 } // namespace chrome_launcher
52 #endif // CHROME_FRAME_CHROME_LAUNCHER_H_