OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/updater/extension_cache_impl.h" | 5 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
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 const base::FilePath& file_path, | 82 const base::FilePath& file_path, |
83 const std::string& version, | 83 const std::string& version, |
84 const PutExtensionCallback& callback) { | 84 const PutExtensionCallback& callback) { |
85 if (cache_ && CachingAllowed(id)) | 85 if (cache_ && CachingAllowed(id)) |
86 cache_->PutExtension(id, expected_hash, file_path, version, callback); | 86 cache_->PutExtension(id, expected_hash, file_path, version, callback); |
87 else | 87 else |
88 callback.Run(file_path, true); | 88 callback.Run(file_path, true); |
89 } | 89 } |
90 | 90 |
91 bool ExtensionCacheImpl::CachingAllowed(const std::string& id) { | 91 bool ExtensionCacheImpl::CachingAllowed(const std::string& id) { |
92 return ContainsKey(allowed_extensions_, id); | 92 return base::ContainsKey(allowed_extensions_, id); |
93 } | 93 } |
94 | 94 |
95 void ExtensionCacheImpl::OnCacheInitialized() { | 95 void ExtensionCacheImpl::OnCacheInitialized() { |
96 for (std::vector<base::Closure>::iterator it = init_callbacks_.begin(); | 96 for (std::vector<base::Closure>::iterator it = init_callbacks_.begin(); |
97 it != init_callbacks_.end(); ++it) { | 97 it != init_callbacks_.end(); ++it) { |
98 it->Run(); | 98 it->Run(); |
99 } | 99 } |
100 init_callbacks_.clear(); | 100 init_callbacks_.clear(); |
101 | 101 |
102 uint64_t cache_size = 0; | 102 uint64_t cache_size = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // We deliberately keep the file with incorrect hash sum, so that it | 135 // We deliberately keep the file with incorrect hash sum, so that it |
136 // will not be re-downloaded each time. | 136 // will not be re-downloaded each time. |
137 break; | 137 break; |
138 default: | 138 default: |
139 cache_->RemoveExtension(id, hash); | 139 cache_->RemoveExtension(id, hash); |
140 break; | 140 break; |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 } // namespace extensions | 144 } // namespace extensions |
OLD | NEW |