| 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/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::Bind( | 148 base::Bind( |
| 149 &EchoPrivateGetOobeTimestampFunction::SendResponse, this)); | 149 &EchoPrivateGetOobeTimestampFunction::SendResponse, this)); |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Get the OOBE timestamp from file /home/chronos/.oobe_completed. | 153 // Get the OOBE timestamp from file /home/chronos/.oobe_completed. |
| 154 // The timestamp is used to determine when the user first activates the device. | 154 // The timestamp is used to determine when the user first activates the device. |
| 155 // If we can get the timestamp info, return it as yyyy-mm-dd, otherwise, return | 155 // If we can get the timestamp info, return it as yyyy-mm-dd, otherwise, return |
| 156 // an empty string. | 156 // an empty string. |
| 157 bool EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread() { | 157 bool EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread() { |
| 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 158 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 159 | 159 |
| 160 const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; | 160 const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; |
| 161 std::string timestamp = ""; | 161 std::string timestamp = ""; |
| 162 base::File::Info fileInfo; | 162 base::File::Info fileInfo; |
| 163 if (base::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { | 163 if (base::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { |
| 164 base::Time::Exploded ctime; | 164 base::Time::Exploded ctime; |
| 165 fileInfo.creation_time.UTCExplode(&ctime); | 165 fileInfo.creation_time.UTCExplode(&ctime); |
| 166 timestamp += base::StringPrintf("%u-%u-%u", | 166 timestamp += base::StringPrintf("%u-%u-%u", |
| 167 ctime.year, | 167 ctime.year, |
| 168 ctime.month, | 168 ctime.month, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { | 263 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { |
| 264 // Consent should not be true if offers redeeming is disabled. | 264 // Consent should not be true if offers redeeming is disabled. |
| 265 CHECK(redeem_offers_allowed_ || !consent); | 265 CHECK(redeem_offers_allowed_ || !consent); |
| 266 results_ = echo_api::GetUserConsent::Results::Create(consent); | 266 results_ = echo_api::GetUserConsent::Results::Create(consent); |
| 267 SendResponse(true); | 267 SendResponse(true); |
| 268 | 268 |
| 269 // Release the reference added in |OnRedeemOffersAllowedChecked|, before | 269 // Release the reference added in |OnRedeemOffersAllowedChecked|, before |
| 270 // showing the dialog. | 270 // showing the dialog. |
| 271 Release(); | 271 Release(); |
| 272 } | 272 } |
| OLD | NEW |