Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: components/policy/core/common/cloud/component_cloud_policy_store.cc

Issue 2830033003: Use {To/From}JavaTime for policy timestamps (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/policy/core/common/cloud/component_cloud_policy_store.cc
diff --git a/components/policy/core/common/cloud/component_cloud_policy_store.cc b/components/policy/core/common/cloud/component_cloud_policy_store.cc
index b6a62ea75b728021e9821835d589c7cb11796bdc..7ca3d1b24daf7e6623ab368df0c9ada89cfd3af5 100644
--- a/components/policy/core/common/cloud/component_cloud_policy_store.cc
+++ b/components/policy/core/common/cloud/component_cloud_policy_store.cc
@@ -72,10 +72,6 @@ const DomainConstants* GetDomainConstantsForType(const std::string& type) {
return nullptr;
}
-base::Time GetTimeFromPolicyTimestamp(int64_t timestamp) {
- return base::Time::UnixEpoch() + base::TimeDelta::FromMilliseconds(timestamp);
-}
-
} // namespace
ComponentCloudPolicyStore::Delegate::~Delegate() {}
@@ -171,7 +167,7 @@ void ComponentCloudPolicyStore::Load() {
policy_bundle_.Get(ns).Swap(&policy);
cached_hashes_[ns] = payload.secure_hash();
stored_policy_times_[ns] =
- GetTimeFromPolicyTimestamp(policy_data.timestamp());
+ base::Time::FromJavaTime(policy_data.timestamp());
} else {
// The data for this proto couldn't be loaded or is corrupted.
Delete(ns);
@@ -201,8 +197,7 @@ bool ComponentCloudPolicyStore::Store(
// And expose the policy.
policy_bundle_.Get(ns).Swap(&policy);
cached_hashes_[ns] = secure_hash;
- stored_policy_times_[ns] =
- GetTimeFromPolicyTimestamp(policy_data->timestamp());
+ stored_policy_times_[ns] = base::Time::FromJavaTime(policy_data->timestamp());
delegate_->OnComponentCloudPolicyStoreUpdated();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698