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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { | 126 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { |
127 std::string config; | 127 std::string config; |
128 if (!base::ReadFileToString(config_path, &config)) | 128 if (!base::ReadFileToString(config_path, &config)) |
129 return false; | 129 return false; |
130 | 130 |
131 std::unique_ptr<base::Value> root = | 131 std::unique_ptr<base::Value> root = |
132 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS); | 132 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS); |
133 DCHECK(root.get() != NULL); | 133 DCHECK(root.get() != NULL); |
134 if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) { | 134 if (!root.get() || root->GetType() != base::Value::Type::DICTIONARY) { |
135 LOG(WARNING) << "Bad cellular config file"; | 135 LOG(WARNING) << "Bad cellular config file"; |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 base::DictionaryValue* root_dict = | 139 base::DictionaryValue* root_dict = |
140 static_cast<base::DictionaryValue*>(root.get()); | 140 static_cast<base::DictionaryValue*>(root.get()); |
141 if (!root_dict->GetString(kVersionField, &version_)) { | 141 if (!root_dict->GetString(kVersionField, &version_)) { |
142 LOG(WARNING) << "Cellular config file missing version"; | 142 LOG(WARNING) << "Cellular config file missing version"; |
143 return false; | 143 return false; |
144 } | 144 } |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 cellular_plan_payment_time_ = base::Time::Now(); | 1162 cellular_plan_payment_time_ = base::Time::Now(); |
1163 } | 1163 } |
1164 | 1164 |
1165 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1165 bool MobileActivator::HasRecentCellularPlanPayment() const { |
1166 const int kRecentPlanPaymentHours = 6; | 1166 const int kRecentPlanPaymentHours = 6; |
1167 return (base::Time::Now() - | 1167 return (base::Time::Now() - |
1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
1169 } | 1169 } |
1170 | 1170 |
1171 } // namespace chromeos | 1171 } // namespace chromeos |
OLD | NEW |