| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/system/statistics_provider.h" | 5 #include "chromeos/system/statistics_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 496 |
| 497 // Finished loading the statistics. | 497 // Finished loading the statistics. |
| 498 on_statistics_loaded_.Signal(); | 498 on_statistics_loaded_.Signal(); |
| 499 VLOG(1) << "Finished loading statistics."; | 499 VLOG(1) << "Finished loading statistics."; |
| 500 } | 500 } |
| 501 | 501 |
| 502 void StatisticsProviderImpl::LoadRegionsFile(const base::FilePath& filename) { | 502 void StatisticsProviderImpl::LoadRegionsFile(const base::FilePath& filename) { |
| 503 JSONFileValueDeserializer regions_file(filename); | 503 JSONFileValueDeserializer regions_file(filename); |
| 504 int regions_error_code = 0; | 504 int regions_error_code = 0; |
| 505 std::string regions_error_message; | 505 std::string regions_error_message; |
| 506 regional_data_.reset( | 506 regional_data_ = |
| 507 regions_file.Deserialize(®ions_error_code, ®ions_error_message)); | 507 regions_file.Deserialize(®ions_error_code, ®ions_error_message); |
| 508 if (!regional_data_.get()) { | 508 if (!regional_data_.get()) { |
| 509 if (base::SysInfo::IsRunningOnChromeOS()) | 509 if (base::SysInfo::IsRunningOnChromeOS()) |
| 510 LOG(ERROR) << "Failed to load regions file '" << filename.value() | 510 LOG(ERROR) << "Failed to load regions file '" << filename.value() |
| 511 << "': error='" << regions_error_message << "'"; | 511 << "': error='" << regions_error_message << "'"; |
| 512 | 512 |
| 513 return; | 513 return; |
| 514 } | 514 } |
| 515 const base::DictionaryValue* full_dict = nullptr; | 515 const base::DictionaryValue* full_dict = nullptr; |
| 516 if (!regional_data_->GetAsDictionary(&full_dict)) { | 516 if (!regional_data_->GetAsDictionary(&full_dict)) { |
| 517 LOG(ERROR) << "Bad regions file '" << filename.value() | 517 LOG(ERROR) << "Bad regions file '" << filename.value() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 return StatisticsProviderImpl::GetInstance(); | 559 return StatisticsProviderImpl::GetInstance(); |
| 560 } | 560 } |
| 561 | 561 |
| 562 // static | 562 // static |
| 563 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { | 563 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { |
| 564 g_test_statistics_provider = test_provider; | 564 g_test_statistics_provider = test_provider; |
| 565 } | 565 } |
| 566 | 566 |
| 567 } // namespace system | 567 } // namespace system |
| 568 } // namespace chromeos | 568 } // namespace chromeos |
| OLD | NEW |