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/policy/device_local_account_policy_service.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // |subdirectories_to_keep| may be running while the clean-up is in progress. | 82 // |subdirectories_to_keep| may be running while the clean-up is in progress. |
83 void DeleteOrphanedCaches( | 83 void DeleteOrphanedCaches( |
84 const base::FilePath& cache_root_dir, | 84 const base::FilePath& cache_root_dir, |
85 const std::set<std::string>& subdirectories_to_keep) { | 85 const std::set<std::string>& subdirectories_to_keep) { |
86 base::FileEnumerator enumerator(cache_root_dir, | 86 base::FileEnumerator enumerator(cache_root_dir, |
87 false, | 87 false, |
88 base::FileEnumerator::DIRECTORIES); | 88 base::FileEnumerator::DIRECTORIES); |
89 for (base::FilePath path = enumerator.Next(); !path.empty(); | 89 for (base::FilePath path = enumerator.Next(); !path.empty(); |
90 path = enumerator.Next()) { | 90 path = enumerator.Next()) { |
91 const std::string subdirectory(path.BaseName().MaybeAsASCII()); | 91 const std::string subdirectory(path.BaseName().MaybeAsASCII()); |
92 if (!ContainsKey(subdirectories_to_keep, subdirectory)) | 92 if (!base::ContainsKey(subdirectories_to_keep, subdirectory)) |
93 base::DeleteFile(path, true); | 93 base::DeleteFile(path, true); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 // Removes the subdirectory belonging to |account_id_to_delete| from the cache | 97 // Removes the subdirectory belonging to |account_id_to_delete| from the cache |
98 // directory. No cache belonging to |account_id_to_delete| may be running while | 98 // directory. No cache belonging to |account_id_to_delete| may be running while |
99 // the removal is in progress. | 99 // the removal is in progress. |
100 void DeleteObsoleteExtensionCache(const std::string& account_id_to_delete) { | 100 void DeleteObsoleteExtensionCache(const std::string& account_id_to_delete) { |
101 base::FilePath cache_root_dir; | 101 base::FilePath cache_root_dir; |
102 CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, | 102 CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 557 } |
558 return nullptr; | 558 return nullptr; |
559 } | 559 } |
560 | 560 |
561 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( | 561 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( |
562 const std::string& user_id) { | 562 const std::string& user_id) { |
563 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); | 563 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); |
564 } | 564 } |
565 | 565 |
566 } // namespace policy | 566 } // namespace policy |
OLD | NEW |