diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 19:42:54 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 19:42:54 +0000 |
commit | 404df1613316a15634d5ba70fdbf32c85c0032e4 (patch) | |
tree | f6bab7adf02b7f785aa2101466a32b5eee8404df /base/command_line.h | |
parent | fc33e999e1c6426050e231d8dfcc38ddd3deb375 (diff) | |
download | chromium_src-404df1613316a15634d5ba70fdbf32c85c0032e4.zip chromium_src-404df1613316a15634d5ba70fdbf32c85c0032e4.tar.gz chromium_src-404df1613316a15634d5ba70fdbf32c85c0032e4.tar.bz2 |
This is a new version of the older patch. Main changes include:
1. Rebased to a never Git revision to make things easier to land.
2. Chrome will now preserve the command line switches except for those that are
blacklisted.
3. Fixed a race condition that would cause the browser to think it didn't exit
cleanly after it's been restarted.
4. Fixed minor nits and omissions (indentation, etc).
This patch adds a timer which fires every 6 hours and checks whether the
browser is in the "persistent" (background) mode, and whether there's an
update pending restart. If both conditions are true, the browser is
restarted with blacklisted command line keys and all loose values stripped. In order to
restart the browser in the background mode, the --long-lived-extensions
key is also added to the command line.
This change is Windows-only, and it won't become fully functional until
Drew (atwilson) checks in his work that enables Chrome to go into background.
Review URL: http://codereview.chromium.org/1617001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.h')
-rw-r--r-- | base/command_line.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/base/command_line.h b/base/command_line.h index b49fe0f..864cb56 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -37,6 +37,9 @@ class CommandLine { explicit CommandLine(ArgumentsOnly args_only); #if defined(OS_WIN) + // The type of native command line arguments. + typedef std::wstring StringType; + // Initialize by parsing the given command-line string. // The program name is assumed to be the first item in the string. void ParseFromString(const std::wstring& command_line); @@ -46,6 +49,9 @@ class CommandLine { return cmd; } #elif defined(OS_POSIX) + // The type of native command line arguments. + typedef std::string StringType; + // Initialize from an argv vector. void InitFromArgv(int argc, const char* const* argv); void InitFromArgv(const std::vector<std::string>& argv); @@ -123,6 +129,11 @@ class CommandLine { // Get the number of switches in this process. size_t GetSwitchCount() const { return switches_.size(); } + // Get a copy of all switches, along with their values + std::map<std::string, StringType> GetSwitches() const { + return switches_; + } + // Get the remaining arguments to the command. // WARNING: this is incorrect on POSIX; we must do string conversions. std::vector<std::wstring> GetLooseValues() const; @@ -204,19 +215,11 @@ class CommandLine { #if defined(OS_WIN) // The quoted, space-separated command-line string. std::wstring command_line_string_; - // The name of the program. std::wstring program_; - - // The type of native command line arguments. - typedef std::wstring StringType; - #elif defined(OS_POSIX) // The argv array, with the program name in argv_[0]. std::vector<std::string> argv_; - - // The type of native command line arguments. - typedef std::string StringType; #endif // Returns true and fills in |switch_string| and |switch_value| |