| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/chromeos/system/runtime_environment.h" | 5 #include "base/chromeos/chromeos_version.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 namespace chromeos { | 13 namespace chromeos { |
| 13 namespace system { | |
| 14 namespace runtime_environment { | |
| 15 | 14 |
| 16 bool IsRunningOnChromeOS() { | 15 bool IsRunningOnChromeOS() { |
| 17 // Check if the user name is chronos. Note that we don't go with | 16 // Check if the user name is chronos. Note that we don't go with |
| 18 // getuid() + getpwuid_r() as it may end up reading /etc/passwd, which | 17 // getuid() + getpwuid_r() as it may end up reading /etc/passwd, which |
| 19 // can be expensive. | 18 // can be expensive. |
| 20 const char* user = getenv("USER"); | 19 const char* user = getenv("USER"); |
| 21 return user && strcmp(user, "chronos") == 0; | 20 return user && strcmp(user, "chronos") == 0; |
| 22 } | 21 } |
| 23 | 22 |
| 24 } // namespace runtime_environment | |
| 25 } // namespace system | |
| 26 } // namespace chromeos | 23 } // namespace chromeos |
| 24 } // namespace base |
| OLD | NEW |