OLD | NEW |
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 "chrome/browser/chromeos/extensions/echo_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 // Get the OOBE timestamp from file /home/chronos/.oobe_completed. | 164 // Get the OOBE timestamp from file /home/chronos/.oobe_completed. |
165 // The timestamp is used to determine when the user first activates the device. | 165 // The timestamp is used to determine when the user first activates the device. |
166 // If we can get the timestamp info, return it as yyyy-mm-dd, otherwise, return | 166 // If we can get the timestamp info, return it as yyyy-mm-dd, otherwise, return |
167 // an empty string. | 167 // an empty string. |
168 bool EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread() { | 168 bool EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread() { |
169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
170 | 170 |
171 const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; | 171 const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; |
172 std::string timestamp = ""; | 172 std::string timestamp = ""; |
173 base::PlatformFileInfo fileInfo; | 173 base::File::Info fileInfo; |
174 if (base::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { | 174 if (base::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { |
175 base::Time::Exploded ctime; | 175 base::Time::Exploded ctime; |
176 fileInfo.creation_time.UTCExplode(&ctime); | 176 fileInfo.creation_time.UTCExplode(&ctime); |
177 timestamp += base::StringPrintf("%u-%u-%u", | 177 timestamp += base::StringPrintf("%u-%u-%u", |
178 ctime.year, | 178 ctime.year, |
179 ctime.month, | 179 ctime.month, |
180 ctime.day_of_month); | 180 ctime.day_of_month); |
181 } | 181 } |
182 results_ = echo_api::GetOobeTimestamp::Results::Create(timestamp); | 182 results_ = echo_api::GetOobeTimestamp::Results::Create(timestamp); |
183 return true; | 183 return true; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { | 274 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { |
275 // Consent should not be true if offers redeeming is disabled. | 275 // Consent should not be true if offers redeeming is disabled. |
276 CHECK(redeem_offers_allowed_ || !consent); | 276 CHECK(redeem_offers_allowed_ || !consent); |
277 results_ = echo_api::GetUserConsent::Results::Create(consent); | 277 results_ = echo_api::GetUserConsent::Results::Create(consent); |
278 SendResponse(true); | 278 SendResponse(true); |
279 | 279 |
280 // Release the reference added in |OnRedeemOffersAllowedChecked|, before | 280 // Release the reference added in |OnRedeemOffersAllowedChecked|, before |
281 // showing the dialog. | 281 // showing the dialog. |
282 Release(); | 282 Release(); |
283 } | 283 } |
OLD | NEW |