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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/install_static/install_util.h" 5 #include "chrome/install_static/install_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <assert.h> 8 #include <assert.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iostream> 10 #include <iostream>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 const wchar_t kHeadless[] = L"CHROME_HEADLESS"; 60 const wchar_t kHeadless[] = L"CHROME_HEADLESS";
61 const wchar_t kShowRestart[] = L"CHROME_CRASHED"; 61 const wchar_t kShowRestart[] = L"CHROME_CRASHED";
62 const wchar_t kRestartInfo[] = L"CHROME_RESTART"; 62 const wchar_t kRestartInfo[] = L"CHROME_RESTART";
63 const wchar_t kRtlLocale[] = L"RIGHT_TO_LEFT"; 63 const wchar_t kRtlLocale[] = L"RIGHT_TO_LEFT";
64 64
65 const char kGpuProcess[] = "gpu-process"; 65 const char kGpuProcess[] = "gpu-process";
66 const char kPpapiPluginProcess[] = "ppapi"; 66 const char kPpapiPluginProcess[] = "ppapi";
67 const char kRendererProcess[] = "renderer"; 67 const char kRendererProcess[] = "renderer";
68 const char kUtilityProcess[] = "utility"; 68 const char kUtilityProcess[] = "utility";
69 const char kProcessType[] = "type";
70 const char kCrashpadHandler[] = "crashpad-handler";
69 71
70 namespace { 72 namespace {
71 73
72 // TODO(ananta) 74 // TODO(ananta)
73 // http://crbug.com/604923 75 // http://crbug.com/604923
74 // These constants are defined in the chrome/installer directory as well. We 76 // These constants are defined in the chrome/installer directory as well. We
75 // need to unify them. 77 // need to unify them.
76 #if defined(GOOGLE_CHROME_BUILD) 78 #if defined(GOOGLE_CHROME_BUILD)
77 const wchar_t kSxSSuffix[] = L" SxS"; 79 const wchar_t kSxSSuffix[] = L" SxS";
78 const wchar_t kGoogleChromeInstallSubDir1[] = L"Google"; 80 const wchar_t kGoogleChromeInstallSubDir1[] = L"Google";
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 *result = -1; 895 *result = -1;
894 return true; 896 return true;
895 } 897 }
896 } 898 }
897 } 899 }
898 // Here it means that both versions are equal. 900 // Here it means that both versions are equal.
899 *result = 0; 901 *result = 0;
900 return true; 902 return true;
901 } 903 }
902 904
905 std::string GetSwitchValueFromCommandLine(const std::string& command_line,
906 const std::string& switch_name) {
907 assert(!command_line.empty());
908 assert(!switch_name.empty());
909
910 // We don't handle command lines with quoted strings. For e.g. something like
911 // --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.
912 if (command_line.find('"') != std::string::npos) {
913 assert(false);
914 return std::string();
915 }
916
917 std::string command_line_copy = command_line;
918 // Remove leading and trailing spaces.
919 TrimT<std::string>(&command_line_copy);
920
921 // Find the switch in the command line. If we don't find the switch, return
922 // an empty string.
923 std::string switch_token = "--";
924 switch_token += switch_name;
925 switch_token += "=";
926 size_t switch_offset = command_line_copy.find(switch_token);
927 if (switch_offset == std::string::npos)
928 return std::string();
929
930 // The format is "--<switch name>=blah". Look for a space after the
931 // "--<switch name>=" string. If we don't find a space assume that the switch
932 // value ends at the end of the command line.
933 size_t switch_value_end_offset =
934 command_line_copy.find_first_of(GetWhiteSpacesForType<std::string>(),
935 switch_offset + switch_token.length());
936 if (switch_value_end_offset == std::string::npos)
937 switch_value_end_offset = command_line_copy.length();
938
939 std::string switch_value = command_line_copy.substr(
940 switch_offset + switch_token.length(),
941 switch_value_end_offset - (switch_offset + switch_token.length()));
942 TrimT<std::string>(&switch_value);
943 return switch_value;
944 }
945
903 } // namespace install_static 946 } // namespace install_static
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698