| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/policy/cloud/component_cloud_policy_store.h" | 5 #include "chrome/browser/policy/cloud/component_cloud_policy_store.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (constants) | 97 if (constants) |
| 98 *domain = constants->domain; | 98 *domain = constants->domain; |
| 99 return constants != NULL; | 99 return constants != NULL; |
| 100 } | 100 } |
| 101 | 101 |
| 102 const std::string& ComponentCloudPolicyStore::GetCachedHash( | 102 const std::string& ComponentCloudPolicyStore::GetCachedHash( |
| 103 const PolicyNamespace& ns) const { | 103 const PolicyNamespace& ns) const { |
| 104 DCHECK(CalledOnValidThread()); | 104 DCHECK(CalledOnValidThread()); |
| 105 std::map<PolicyNamespace, std::string>::const_iterator it = | 105 std::map<PolicyNamespace, std::string>::const_iterator it = |
| 106 cached_hashes_.find(ns); | 106 cached_hashes_.find(ns); |
| 107 return it == cached_hashes_.end() ? EmptyString() : it->second; | 107 return it == cached_hashes_.end() ? base::EmptyString() : it->second; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ComponentCloudPolicyStore::SetCredentials(const std::string& username, | 110 void ComponentCloudPolicyStore::SetCredentials(const std::string& username, |
| 111 const std::string& dm_token) { | 111 const std::string& dm_token) { |
| 112 DCHECK(CalledOnValidThread()); | 112 DCHECK(CalledOnValidThread()); |
| 113 DCHECK(username_.empty() || username == username_); | 113 DCHECK(username_.empty() || username == username_); |
| 114 DCHECK(dm_token_.empty() || dm_token == dm_token_); | 114 DCHECK(dm_token_.empty() || dm_token == dm_token_); |
| 115 username_ = username; | 115 username_ = username; |
| 116 dm_token_ = dm_token; | 116 dm_token_ = dm_token; |
| 117 } | 117 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // If policy for components is ever used for device-level settings then | 352 // If policy for components is ever used for device-level settings then |
| 353 // this must support a configurable scope; assuming POLICY_SCOPE_USER is | 353 // this must support a configurable scope; assuming POLICY_SCOPE_USER is |
| 354 // fine for now. | 354 // fine for now. |
| 355 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); | 355 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); |
| 356 } | 356 } |
| 357 | 357 |
| 358 return true; | 358 return true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace policy | 361 } // namespace policy |
| OLD | NEW |