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

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
« no previous file with comments | « chrome/install_static/install_util.h ('k') | chrome/install_static/install_util_unittest.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 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.
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_start_offset = switch_offset + switch_token.length();
934 if (std::string(kWhiteSpaces).find(
935 command_line_copy[switch_value_start_offset]) != std::string::npos) {
936 switch_value_start_offset = command_line_copy.find_first_not_of(
937 GetWhiteSpacesForType<std::string>(), switch_value_start_offset);
938 if (switch_value_start_offset == std::string::npos)
939 return std::string();
940 }
941 size_t switch_value_end_offset =
942 command_line_copy.find_first_of(GetWhiteSpacesForType<std::string>(),
943 switch_value_start_offset);
944 if (switch_value_end_offset == std::string::npos)
945 switch_value_end_offset = command_line_copy.length();
946
947 std::string switch_value = command_line_copy.substr(
948 switch_value_start_offset,
949 switch_value_end_offset - (switch_offset + switch_token.length()));
950 TrimT<std::string>(&switch_value);
951 return switch_value;
952 }
953
903 } // namespace install_static 954 } // namespace install_static
OLDNEW
« no previous file with comments | « chrome/install_static/install_util.h ('k') | chrome/install_static/install_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698