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

Side by Side Diff: base/sys_info_chromeos.cc

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX Created 5 years 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 | « base/sys_info_android.cc ('k') | base/sys_info_freebsd.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 (c) 2012 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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include "base/basictypes.h"
8 #include "base/environment.h" 7 #include "base/environment.h"
9 #include "base/files/file.h" 8 #include "base/files/file.h"
10 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
12 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
13 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
15 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
16 #include "base/strings/string_tokenizer.h" 15 #include "base/strings/string_tokenizer.h"
17 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 82 }
84 83
85 bool GetLsbReleaseValue(const std::string& key, std::string* value) { 84 bool GetLsbReleaseValue(const std::string& key, std::string* value) {
86 SysInfo::LsbReleaseMap::const_iterator iter = lsb_release_map_.find(key); 85 SysInfo::LsbReleaseMap::const_iterator iter = lsb_release_map_.find(key);
87 if (iter == lsb_release_map_.end()) 86 if (iter == lsb_release_map_.end())
88 return false; 87 return false;
89 *value = iter->second; 88 *value = iter->second;
90 return true; 89 return true;
91 } 90 }
92 91
93 void GetVersionNumbers(int32* major_version, 92 void GetVersionNumbers(int32_t* major_version,
94 int32* minor_version, 93 int32_t* minor_version,
95 int32* bugfix_version) { 94 int32_t* bugfix_version) {
96 *major_version = major_version_; 95 *major_version = major_version_;
97 *minor_version = minor_version_; 96 *minor_version = minor_version_;
98 *bugfix_version = bugfix_version_; 97 *bugfix_version = bugfix_version_;
99 } 98 }
100 99
101 const Time& lsb_release_time() const { return lsb_release_time_; } 100 const Time& lsb_release_time() const { return lsb_release_time_; }
102 const SysInfo::LsbReleaseMap& lsb_release_map() const { 101 const SysInfo::LsbReleaseMap& lsb_release_map() const {
103 return lsb_release_map_; 102 return lsb_release_map_;
104 } 103 }
105 bool is_running_on_chromeos() const { return is_running_on_chromeos_; } 104 bool is_running_on_chromeos() const { return is_running_on_chromeos_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (release_name == kChromeOsReleaseNames[i]) { 146 if (release_name == kChromeOsReleaseNames[i]) {
148 is_running_on_chromeos_ = true; 147 is_running_on_chromeos_ = true;
149 break; 148 break;
150 } 149 }
151 } 150 }
152 } 151 }
153 } 152 }
154 153
155 Time lsb_release_time_; 154 Time lsb_release_time_;
156 SysInfo::LsbReleaseMap lsb_release_map_; 155 SysInfo::LsbReleaseMap lsb_release_map_;
157 int32 major_version_; 156 int32_t major_version_;
158 int32 minor_version_; 157 int32_t minor_version_;
159 int32 bugfix_version_; 158 int32_t bugfix_version_;
160 bool is_running_on_chromeos_; 159 bool is_running_on_chromeos_;
161 }; 160 };
162 161
163 static LazyInstance<ChromeOSVersionInfo> 162 static LazyInstance<ChromeOSVersionInfo>
164 g_chrome_os_version_info = LAZY_INSTANCE_INITIALIZER; 163 g_chrome_os_version_info = LAZY_INSTANCE_INITIALIZER;
165 164
166 ChromeOSVersionInfo& GetChromeOSVersionInfo() { 165 ChromeOSVersionInfo& GetChromeOSVersionInfo() {
167 return g_chrome_os_version_info.Get(); 166 return g_chrome_os_version_info.Get();
168 } 167 }
169 168
170 } // namespace 169 } // namespace
171 170
172 // static 171 // static
173 void SysInfo::OperatingSystemVersionNumbers(int32* major_version, 172 void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
174 int32* minor_version, 173 int32_t* minor_version,
175 int32* bugfix_version) { 174 int32_t* bugfix_version) {
176 return GetChromeOSVersionInfo().GetVersionNumbers( 175 return GetChromeOSVersionInfo().GetVersionNumbers(
177 major_version, minor_version, bugfix_version); 176 major_version, minor_version, bugfix_version);
178 } 177 }
179 178
180 // static 179 // static
181 const SysInfo::LsbReleaseMap& SysInfo::GetLsbReleaseMap() { 180 const SysInfo::LsbReleaseMap& SysInfo::GetLsbReleaseMap() {
182 return GetChromeOSVersionInfo().lsb_release_map(); 181 return GetChromeOSVersionInfo().lsb_release_map();
183 } 182 }
184 183
185 // static 184 // static
(...skipping 24 matching lines...) Expand all
210 void SysInfo::SetChromeOSVersionInfoForTest(const std::string& lsb_release, 209 void SysInfo::SetChromeOSVersionInfoForTest(const std::string& lsb_release,
211 const Time& lsb_release_time) { 210 const Time& lsb_release_time) {
212 scoped_ptr<Environment> env(Environment::Create()); 211 scoped_ptr<Environment> env(Environment::Create());
213 env->SetVar(kLsbReleaseKey, lsb_release); 212 env->SetVar(kLsbReleaseKey, lsb_release);
214 env->SetVar(kLsbReleaseTimeKey, 213 env->SetVar(kLsbReleaseTimeKey,
215 DoubleToString(lsb_release_time.ToDoubleT())); 214 DoubleToString(lsb_release_time.ToDoubleT()));
216 g_chrome_os_version_info.Get().Parse(); 215 g_chrome_os_version_info.Get().Parse();
217 } 216 }
218 217
219 } // namespace base 218 } // namespace base
OLDNEW
« no previous file with comments | « base/sys_info_android.cc ('k') | base/sys_info_freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698