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/extensions/api/storage/managed_value_store_cache.h" | 5 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 manifest_keys::kStorageManagedSchema, &schema_file)) { | 199 manifest_keys::kStorageManagedSchema, &schema_file)) { |
200 // TODO(joaodasilva): Remove this. http://crbug.com/325349 | 200 // TODO(joaodasilva): Remove this. http://crbug.com/325349 |
201 (*components)[(*it)->id()] = policy::Schema(); | 201 (*components)[(*it)->id()] = policy::Schema(); |
202 continue; | 202 continue; |
203 } | 203 } |
204 // The extension should have been validated, so assume the schema exists | 204 // The extension should have been validated, so assume the schema exists |
205 // and is valid. | 205 // and is valid. |
206 std::string error; | 206 std::string error; |
207 policy::Schema schema = | 207 policy::Schema schema = |
208 StorageSchemaManifestHandler::GetSchema(it->get(), &error); | 208 StorageSchemaManifestHandler::GetSchema(it->get(), &error); |
209 CHECK(schema.valid()) << error; | |
210 (*components)[(*it)->id()] = schema; | 209 (*components)[(*it)->id()] = schema; |
not at google - send to devlin
2014/08/12 20:13:17
Now you'll be adding a potentially invalid schema
Joao da Silva
2014/08/13 10:05:03
Not quite, thanks for pointing this out :-) What w
| |
211 } | 210 } |
212 | 211 |
213 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 212 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
214 base::Bind(&ExtensionTracker::Register, self, | 213 base::Bind(&ExtensionTracker::Register, self, |
215 base::Owned(components.release()))); | 214 base::Owned(components.release()))); |
216 } | 215 } |
217 | 216 |
218 void ManagedValueStoreCache::ExtensionTracker::Register( | 217 void ManagedValueStoreCache::ExtensionTracker::Register( |
219 const policy::ComponentMap* components) { | 218 const policy::ComponentMap* components) { |
220 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 | 364 |
366 return store; | 365 return store; |
367 } | 366 } |
368 | 367 |
369 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { | 368 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { |
370 // TODO(joaodasilva): move this check to a ValueStore method. | 369 // TODO(joaodasilva): move this check to a ValueStore method. |
371 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); | 370 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); |
372 } | 371 } |
373 | 372 |
374 } // namespace extensions | 373 } // namespace extensions |
OLD | NEW |