Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.cc

Issue 24367003: Refactored users of PolicySchema to use the new policy::Schema class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop/message_loop_proxy.h" 13 #include "base/message_loop/message_loop_proxy.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/extensions/api/storage/policy_value_store.h" 15 #include "chrome/browser/extensions/api/storage/policy_value_store.h"
16 #include "chrome/browser/extensions/api/storage/settings_storage_factory.h" 16 #include "chrome/browser/extensions/api/storage/settings_storage_factory.h"
17 #include "chrome/browser/extensions/extension_prefs.h" 17 #include "chrome/browser/extensions/extension_prefs.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_system.h" 19 #include "chrome/browser/extensions/extension_system.h"
20 #include "chrome/browser/policy/policy_domain_descriptor.h" 20 #include "chrome/browser/policy/policy_domain_descriptor.h"
21 #include "chrome/browser/policy/profile_policy_connector.h" 21 #include "chrome/browser/policy/profile_policy_connector.h"
22 #include "chrome/browser/policy/profile_policy_connector_factory.h" 22 #include "chrome/browser/policy/profile_policy_connector_factory.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/value_store/value_store_change.h" 24 #include "chrome/browser/value_store/value_store_change.h"
25 #include "chrome/common/extensions/api/storage.h" 25 #include "chrome/common/extensions/api/storage.h"
26 #include "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h " 26 #include "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h "
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/extensions/extension_set.h" 28 #include "chrome/common/extensions/extension_set.h"
29 #include "chrome/common/extensions/permissions/api_permission.h" 29 #include "chrome/common/extensions/permissions/api_permission.h"
30 #include "components/policy/core/common/policy_schema.h" 30 #include "components/policy/core/common/schema.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/notification_observer.h" 32 #include "content/public/browser/notification_observer.h"
33 #include "content/public/browser/notification_registrar.h" 33 #include "content/public/browser/notification_registrar.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "extensions/common/manifest.h" 35 #include "extensions/common/manifest.h"
36 #include "extensions/common/manifest_constants.h" 36 #include "extensions/common/manifest_constants.h"
37 37
38 using content::BrowserThread; 38 using content::BrowserThread;
39 39
40 namespace extensions { 40 namespace extensions {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 scoped_ptr<ExtensionSet> extensions, 130 scoped_ptr<ExtensionSet> extensions,
131 base::WeakPtr<ExtensionTracker> self) { 131 base::WeakPtr<ExtensionTracker> self) {
132 scoped_refptr<policy::PolicyDomainDescriptor> descriptor = 132 scoped_refptr<policy::PolicyDomainDescriptor> descriptor =
133 new policy::PolicyDomainDescriptor(policy::POLICY_DOMAIN_EXTENSIONS); 133 new policy::PolicyDomainDescriptor(policy::POLICY_DOMAIN_EXTENSIONS);
134 134
135 for (ExtensionSet::const_iterator it = extensions->begin(); 135 for (ExtensionSet::const_iterator it = extensions->begin();
136 it != extensions->end(); ++it) { 136 it != extensions->end(); ++it) {
137 std::string schema_file; 137 std::string schema_file;
138 if (!(*it)->manifest()->GetString( 138 if (!(*it)->manifest()->GetString(
139 manifest_keys::kStorageManagedSchema, &schema_file)) { 139 manifest_keys::kStorageManagedSchema, &schema_file)) {
140 // TODO(joaodasilva): Remove this for M30. http://crbug.com/240704 140 // TODO(joaodasilva): Remove this for M32. http://crbug.com/240704
141 if ((*it)->HasAPIPermission(APIPermission::kStorage)) { 141 if ((*it)->HasAPIPermission(APIPermission::kStorage)) {
142 descriptor->RegisterComponent((*it)->id(), 142 descriptor->RegisterComponent((*it)->id(),
143 scoped_ptr<policy::PolicySchema>()); 143 scoped_ptr<policy::SchemaOwner>());
144 } else { 144 } else {
145 NOTREACHED(); 145 NOTREACHED();
146 } 146 }
147 continue; 147 continue;
148 } 148 }
149 // The extension should have been validated, so assume the schema exists 149 // The extension should have been validated, so assume the schema exists
150 // and is valid. 150 // and is valid.
151 std::string error; 151 std::string error;
152 scoped_ptr<policy::PolicySchema> schema = 152 scoped_ptr<policy::SchemaOwner> schema =
153 StorageSchemaManifestHandler::GetSchema(it->get(), &error); 153 StorageSchemaManifestHandler::GetSchema(it->get(), &error);
154 CHECK(schema) << error; 154 CHECK(schema) << error;
155 descriptor->RegisterComponent((*it)->id(), schema.Pass()); 155 descriptor->RegisterComponent((*it)->id(), schema.Pass());
156 } 156 }
157 157
158 BrowserThread::PostTask( 158 BrowserThread::PostTask(
159 BrowserThread::UI, FROM_HERE, 159 BrowserThread::UI, FROM_HERE,
160 base::Bind(&ExtensionTracker::RegisterDomain, self, descriptor)); 160 base::Bind(&ExtensionTracker::RegisterDomain, self, descriptor));
161 } 161 }
162 162
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 continuation.Run(); 403 continuation.Run();
404 } 404 }
405 405
406 policy::PolicyService* ManagedValueStoreCache::GetPolicyService() { 406 policy::PolicyService* ManagedValueStoreCache::GetPolicyService() {
407 policy::ProfilePolicyConnector* connector = 407 policy::ProfilePolicyConnector* connector =
408 policy::ProfilePolicyConnectorFactory::GetForProfile(profile_); 408 policy::ProfilePolicyConnectorFactory::GetForProfile(profile_);
409 return connector->policy_service(); 409 return connector->policy_service();
410 } 410 }
411 411
412 } // namespace extensions 412 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698