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

Side by Side Diff: chrome_frame/chrome_launcher.h

Issue 2278003: Rewrite of chrome_launcher.exe. ETW-based perf tests suggest that this is on ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame_launcher.gyp ('k') | chrome_frame/chrome_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_FRAME_CHROME_LAUNCHER_H_ 5 #ifndef CHROME_FRAME_CHROME_LAUNCHER_H_
6 #define CHROME_FRAME_CHROME_LAUNCHER_H_ 6 #define CHROME_FRAME_CHROME_LAUNCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 // arraysize macro shamelessly stolen from base\basictypes.h
11 template <typename T, size_t N>
12 char (&ArraySizeHelper(T (&array)[N]))[N];
11 13
12 class CommandLine; 14 #define arraysize(array) (sizeof(ArraySizeHelper(array)))
13 15
14 namespace chrome_launcher { 16 namespace chrome_launcher {
15 17
16 // The base name of the chrome_launcher.exe file. 18 // The base name of the chrome_launcher.exe file.
17 extern const wchar_t kLauncherExeBaseName[]; 19 extern const wchar_t kLauncherExeBaseName[];
18 20
19 // Creates a command line suitable for launching Chrome. You can add any 21 // Returns true if command_line contains only flags that we allow through.
20 // flags needed before launching. 22 // Returns false if command_line contains any unrecognized flags.
21 // 23 bool IsValidCommandLine(const wchar_t* command_line);
22 // The command-line may use the Chrome executable directly, or use an in-between
23 // process if needed for security/elevation purposes. You must delete the
24 // returned command line.
25 CommandLine* CreateLaunchCommandLine();
26
27 // Fills in a new command line from the flags on this process's command line
28 // that we are allowing Low Integrity to invoke.
29 //
30 // Logs a warning for any flags that were passed that are not allowed to be
31 // invoked by Low Integrity.
32 void SanitizeCommandLine(const CommandLine& original, CommandLine* sanitized);
33 24
34 // Given a command-line without an initial program part, launch our associated 25 // Given a command-line without an initial program part, launch our associated
35 // chrome.exe with a sanitized version of that command line. Returns true iff 26 // chrome.exe with a sanitized version of that command line. Returns true iff
36 // successful. 27 // successful.
37 bool SanitizeAndLaunchChrome(const wchar_t* command_line); 28 bool SanitizeAndLaunchChrome(const wchar_t* command_line);
38 29
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);
35
39 // Returns the full path to the Chrome executable. 36 // Returns the full path to the Chrome executable.
40 FilePath GetChromeExecutablePath(); 37 bool GetChromeExecutablePath(std::wstring* chrome_path);
41 38
42 // The type of the CfLaunchChrome entrypoint exported from this DLL. 39 // Returns whether a given argument is considered a valid flag. Only accepts
43 typedef int (__stdcall *CfLaunchChromeProc)(); 40 // flags of the forms:
41 // --foo
42 // --foo=bar
43 bool IsValidArgument(const std::wstring& argument);
44
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);
44 49
45 } // namespace chrome_launcher 50 } // namespace chrome_launcher
46 51
47 #endif // CHROME_FRAME_CHROME_LAUNCHER_H_ 52 #endif // CHROME_FRAME_CHROME_LAUNCHER_H_
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_launcher.gyp ('k') | chrome_frame/chrome_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698