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; | 209 // If the schema is invalid then proceed with an empty schema. The extension |
210 // will be listed in chrome://policy but won't be able to load any policies. | |
not at google - send to devlin
2014/08/13 17:27:31
It'd be nice to try to recover the policy in this
Joao da Silva
2014/08/14 11:56:57
sgtm. Shouldn't we try to do the same recovery for
| |
211 if (!schema.valid()) | |
212 schema = policy::Schema(); | |
210 (*components)[(*it)->id()] = schema; | 213 (*components)[(*it)->id()] = schema; |
211 } | 214 } |
212 | 215 |
213 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 216 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
214 base::Bind(&ExtensionTracker::Register, self, | 217 base::Bind(&ExtensionTracker::Register, self, |
215 base::Owned(components.release()))); | 218 base::Owned(components.release()))); |
216 } | 219 } |
217 | 220 |
218 void ManagedValueStoreCache::ExtensionTracker::Register( | 221 void ManagedValueStoreCache::ExtensionTracker::Register( |
219 const policy::ComponentMap* components) { | 222 const policy::ComponentMap* components) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 | 368 |
366 return store; | 369 return store; |
367 } | 370 } |
368 | 371 |
369 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { | 372 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { |
370 // TODO(joaodasilva): move this check to a ValueStore method. | 373 // TODO(joaodasilva): move this check to a ValueStore method. |
371 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); | 374 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); |
372 } | 375 } |
373 | 376 |
374 } // namespace extensions | 377 } // namespace extensions |
OLD | NEW |