OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/linux_util.h" | 5 #include "base/linux_util.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // little reason to believe it will work if we attempt to run | 136 // little reason to believe it will work if we attempt to run |
137 // lsb_release again. | 137 // lsb_release again. |
138 std::vector<std::string> argv; | 138 std::vector<std::string> argv; |
139 argv.push_back("lsb_release"); | 139 argv.push_back("lsb_release"); |
140 argv.push_back("-d"); | 140 argv.push_back("-d"); |
141 std::string output; | 141 std::string output; |
142 base::GetAppOutput(CommandLine(argv), &output); | 142 base::GetAppOutput(CommandLine(argv), &output); |
143 if (output.length() > 0) { | 143 if (output.length() > 0) { |
144 // lsb_release -d should return: Description:<tab>Distro Info | 144 // lsb_release -d should return: Description:<tab>Distro Info |
145 static const std::string field = "Description:\t"; | 145 static const std::string field = "Description:\t"; |
146 if (output.compare(0, field.length(), field) == 0) | 146 if (output.compare(0, field.length(), field) == 0) { |
147 linux_distro = output.substr(field.length()); | 147 linux_distro = output.substr(field.length()); |
| 148 TrimWhitespaceASCII(linux_distro, TRIM_ALL, &linux_distro); |
| 149 } |
148 } | 150 } |
149 distro_state_singleton->CheckFinished(); | 151 distro_state_singleton->CheckFinished(); |
150 return linux_distro; | 152 return linux_distro; |
151 } else if (STATE_CHECK_STARTED == state) { | 153 } else if (STATE_CHECK_STARTED == state) { |
152 // If the distro check above is in progress in some other thread, we're | 154 // If the distro check above is in progress in some other thread, we're |
153 // not going to wait for the results. | 155 // not going to wait for the results. |
154 return "Unknown"; | 156 return "Unknown"; |
155 } else { | 157 } else { |
156 // In STATE_CHECK_FINISHED, no more writing to |linux_distro|. | 158 // In STATE_CHECK_FINISHED, no more writing to |linux_distro|. |
157 return linux_distro; | 159 return linux_distro; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return "KDE4"; | 203 return "KDE4"; |
202 } | 204 } |
203 return NULL; | 205 return NULL; |
204 } | 206 } |
205 | 207 |
206 const char* GetDesktopEnvironmentName(EnvironmentVariableGetter* env) { | 208 const char* GetDesktopEnvironmentName(EnvironmentVariableGetter* env) { |
207 return GetDesktopEnvironmentName(GetDesktopEnvironment(env)); | 209 return GetDesktopEnvironmentName(GetDesktopEnvironment(env)); |
208 } | 210 } |
209 | 211 |
210 } // namespace base | 212 } // namespace base |
OLD | NEW |