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

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) {
scottmg 2016/06/14 15:58:48 I guess this will fail in the same way as Google D
ananta 2016/06/14 19:13:15 Added a check for that with an assert
907 assert(!command_line.empty());
908 assert(!switch_name.empty());
909
910 std::string command_line_copy = command_line;
911 // Remove leading and trailing spaces.
912 TrimT<std::string>(&command_line_copy);
913
914 // Find the switch in the command line. If we don't find the switch, return
915 // an empty string.
916 std::string switch_token = "--";
917 switch_token += switch_name;
918 switch_token += "=";
919 size_t switch_offset = command_line_copy.find(switch_token);
920 if (switch_offset == std::string::npos)
921 return std::string();
922
923 // The format is "--<switch name>=blah". Look for a space after the
924 // "--<switch name>=" string. If we don't find a space assume that the switch
925 // value ends at the end of the command line.
926 size_t switch_value_end_offset =
927 command_line_copy.find_first_of(GetWhiteSpacesForType<std::string>(),
928 switch_offset + switch_token.length());
929 if (switch_value_end_offset == std::string::npos)
930 switch_value_end_offset = command_line_copy.length();
931
932 std::string switch_value = command_line_copy.substr(
933 switch_offset + switch_token.length(),
934 switch_value_end_offset - (switch_offset + switch_token.length()));
935 TrimT<std::string>(&switch_value);
936 return switch_value;
937 }
938
903 } // namespace install_static 939 } // namespace install_static
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698