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/mobile/mobile_activator.h" | 5 #include "chrome/browser/chromeos/mobile/mobile_activator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 void CellularConfigDocument::SetErrorMap( | 112 void CellularConfigDocument::SetErrorMap( |
113 const ErrorMap& map) { | 113 const ErrorMap& map) { |
114 base::AutoLock create(config_lock_); | 114 base::AutoLock create(config_lock_); |
115 error_map_.clear(); | 115 error_map_.clear(); |
116 error_map_.insert(map.begin(), map.end()); | 116 error_map_.insert(map.begin(), map.end()); |
117 } | 117 } |
118 | 118 |
119 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { | 119 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { |
120 std::string config; | 120 std::string config; |
121 if (!file_util::ReadFileToString(config_path, &config)) | 121 if (!base::ReadFileToString(config_path, &config)) |
122 return false; | 122 return false; |
123 | 123 |
124 scoped_ptr<Value> root( | 124 scoped_ptr<Value> root( |
125 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS)); | 125 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS)); |
126 DCHECK(root.get() != NULL); | 126 DCHECK(root.get() != NULL); |
127 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { | 127 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { |
128 LOG(WARNING) << "Bad cellular config file"; | 128 LOG(WARNING) << "Bad cellular config file"; |
129 return false; | 129 return false; |
130 } | 130 } |
131 | 131 |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 cellular_plan_payment_time_ = base::Time::Now(); | 1019 cellular_plan_payment_time_ = base::Time::Now(); |
1020 } | 1020 } |
1021 | 1021 |
1022 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1022 bool MobileActivator::HasRecentCellularPlanPayment() const { |
1023 const int kRecentPlanPaymentHours = 6; | 1023 const int kRecentPlanPaymentHours = 6; |
1024 return (base::Time::Now() - | 1024 return (base::Time::Now() - |
1025 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1025 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
1026 } | 1026 } |
1027 | 1027 |
1028 } // namespace chromeos | 1028 } // namespace chromeos |
OLD | NEW |