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

Side by Side Diff: chrome/browser/chromeos/version_loader.cc

Issue 7633055: base: Fix the TODO in string_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_mini_installer.cc Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/version_loader.h" 5 #include "chrome/browser/chromeos/version_loader.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h"
14 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
15 #include "base/time.h" 16 #include "base/time.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 // File to look for version number in. 22 // File to look for version number in.
22 static const char kPathVersion[] = "/etc/lsb-release"; 23 static const char kPathVersion[] = "/etc/lsb-release";
23 24
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 162 }
162 } 163 }
163 } 164 }
164 } 165 }
165 166
166 if (format == VERSION_SHORT_WITH_DATE) { 167 if (format == VERSION_SHORT_WITH_DATE) {
167 base::PlatformFileInfo fileinfo; 168 base::PlatformFileInfo fileinfo;
168 if (file_util::GetFileInfo(file_path, &fileinfo)) { 169 if (file_util::GetFileInfo(file_path, &fileinfo)) {
169 base::Time::Exploded ctime; 170 base::Time::Exploded ctime;
170 fileinfo.creation_time.UTCExplode(&ctime); 171 fileinfo.creation_time.UTCExplode(&ctime);
171 version += StringPrintf("-%02u.%02u.%02u", 172 version += base::StringPrintf("-%02u.%02u.%02u",
172 ctime.year % 100, 173 ctime.year % 100,
173 ctime.month, 174 ctime.month,
174 ctime.day_of_month); 175 ctime.day_of_month);
175 } 176 }
176 } 177 }
177 178
178 request->ForwardResult(GetVersionCallback::TupleType(request->handle(), 179 request->ForwardResult(GetVersionCallback::TupleType(request->handle(),
179 version)); 180 version));
180 } 181 }
181 182
182 void VersionLoader::Backend::GetFirmware( 183 void VersionLoader::Backend::GetFirmware(
183 scoped_refptr<GetFirmwareRequest> request) { 184 scoped_refptr<GetFirmwareRequest> request) {
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
185 if (request->canceled()) 186 if (request->canceled())
186 return; 187 return;
187 188
188 std::string firmware; 189 std::string firmware;
189 std::string contents; 190 std::string contents;
190 const FilePath file_path(kPathFirmware); 191 const FilePath file_path(kPathFirmware);
191 if (file_util::ReadFileToString(file_path, &contents)) { 192 if (file_util::ReadFileToString(file_path, &contents)) {
192 firmware = ParseFirmware(contents); 193 firmware = ParseFirmware(contents);
193 } 194 }
194 195
195 request->ForwardResult(GetFirmwareCallback::TupleType(request->handle(), 196 request->ForwardResult(GetFirmwareCallback::TupleType(request->handle(),
196 firmware)); 197 firmware));
197 } 198 }
198 199
199 } // namespace chromeos 200 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/syslogs_provider.cc ('k') | chrome/browser/geolocation/wifi_data_provider_unittest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698