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

Unified Diff: chrome/install_static/install_util.cc

Issue 2053953002: Add chrome_crash_reporter_client_win.cc to the source file list for chrome_elf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/install_static/install_util.cc
diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc
index a58b26efcb71ac7bc64a652b2730149d28371b94..2d2b1f9dc06bd5968ada8b387269344d30c8b03d 100644
--- a/chrome/install_static/install_util.cc
+++ b/chrome/install_static/install_util.cc
@@ -66,6 +66,8 @@ const char kGpuProcess[] = "gpu-process";
const char kPpapiPluginProcess[] = "ppapi";
const char kRendererProcess[] = "renderer";
const char kUtilityProcess[] = "utility";
+const char kProcessType[] = "type";
+const char kCrashpadHandler[] = "crashpad-handler";
namespace {
@@ -900,4 +902,45 @@ bool CompareVersionStrings(const std::string& version1,
return true;
}
+std::string GetSwitchValueFromCommandLine(const std::string& command_line,
+ const std::string& switch_name) {
+ assert(!command_line.empty());
+ assert(!switch_name.empty());
+
+ // We don't handle command lines with quoted strings. For e.g. something like
+ // --ignored=" --type=renderer ", which we used for Google desktop.
scottmg 2016/06/14 19:50:36 nit; desktop -> Desktop
ananta 2016/06/14 19:58:54 Done.
+ if (command_line.find('"') != std::string::npos) {
+ assert(false);
+ return std::string();
+ }
+
+ std::string command_line_copy = command_line;
+ // Remove leading and trailing spaces.
+ TrimT<std::string>(&command_line_copy);
+
+ // Find the switch in the command line. If we don't find the switch, return
+ // an empty string.
+ std::string switch_token = "--";
+ switch_token += switch_name;
+ switch_token += "=";
+ size_t switch_offset = command_line_copy.find(switch_token);
+ if (switch_offset == std::string::npos)
+ return std::string();
+
+ // The format is "--<switch name>=blah". Look for a space after the
+ // "--<switch name>=" string. If we don't find a space assume that the switch
+ // value ends at the end of the command line.
+ size_t switch_value_end_offset =
+ command_line_copy.find_first_of(GetWhiteSpacesForType<std::string>(),
+ switch_offset + switch_token.length());
+ if (switch_value_end_offset == std::string::npos)
+ switch_value_end_offset = command_line_copy.length();
+
+ std::string switch_value = command_line_copy.substr(
+ switch_offset + switch_token.length(),
+ switch_value_end_offset - (switch_offset + switch_token.length()));
+ TrimT<std::string>(&switch_value);
+ return switch_value;
+}
+
} // namespace install_static

Powered by Google App Engine
This is Rietveld 408576698