| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/user_policy_token_cache.h" | 5 #include "chrome/browser/policy/user_policy_token_cache.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/policy/enterprise_metrics.h" | 9 #include "chrome/browser/policy/enterprise_metrics.h" |
| 10 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 10 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 LOG(WARNING) << "Failed to create directory " | 113 LOG(WARNING) << "Failed to create directory " |
| 114 << cache_file_.DirName().value(); | 114 << cache_file_.DirName().value(); |
| 115 SampleUMA(kMetricTokenStoreFailed); | 115 SampleUMA(kMetricTokenStoreFailed); |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 | 118 |
| 119 int size = data.size(); | 119 int size = data.size(); |
| 120 if (file_util::WriteFile(cache_file_, data.c_str(), size) != size) { | 120 if (file_util::WriteFile(cache_file_, data.c_str(), size) != size) { |
| 121 LOG(WARNING) << "Failed to write " << cache_file_.value(); | 121 LOG(WARNING) << "Failed to write " << cache_file_.value(); |
| 122 SampleUMA(kMetricTokenStoreFailed); | 122 SampleUMA(kMetricTokenStoreFailed); |
| 123 return; |
| 123 } | 124 } |
| 124 | 125 |
| 125 SampleUMA(kMetricTokenStoreSucceeded); | 126 SampleUMA(kMetricTokenStoreSucceeded); |
| 126 } | 127 } |
| 127 | 128 |
| 128 UserPolicyTokenCache::UserPolicyTokenCache( | 129 UserPolicyTokenCache::UserPolicyTokenCache( |
| 129 CloudPolicyDataStore* data_store, | 130 CloudPolicyDataStore* data_store, |
| 130 const FilePath& cache_file) | 131 const FilePath& cache_file) |
| 131 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 132 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
| 132 data_store_(data_store) { | 133 data_store_(data_store) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 161 | 162 |
| 162 token_ = new_token; | 163 token_ = new_token; |
| 163 loader_->Store(new_token, data_store_->device_id()); | 164 loader_->Store(new_token, data_store_->device_id()); |
| 164 } | 165 } |
| 165 } | 166 } |
| 166 | 167 |
| 167 void UserPolicyTokenCache::OnCredentialsChanged() { | 168 void UserPolicyTokenCache::OnCredentialsChanged() { |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace policy | 171 } // namespace policy |
| OLD | NEW |