summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-14 14:41:10 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-14 14:41:10 +0000
commit183be4e9d92afb48a7c4b1f32e70c95c58af83b8 (patch)
treed68d10dcfc3dcde71765e60f45fc301922be6f19
parent0bce53f7d12f74b1b6249b2ffc1ba6cd238c2fe6 (diff)
downloadchromium_src-183be4e9d92afb48a7c4b1f32e70c95c58af83b8.zip
chromium_src-183be4e9d92afb48a7c4b1f32e70c95c58af83b8.tar.gz
chromium_src-183be4e9d92afb48a7c4b1f32e70c95c58af83b8.tar.bz2
Moved chrome/common/policy to components/policy.
This change also introduces //components/policy as a new layered component. Some of the chrome/browser/policy code is being prepared to be moved into this component. This CL depends on https://codereview.chromium.org/22807004/. BUG=271392 Review URL: https://chromiumcodereview.appspot.com/23045003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217552 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/extensions/api/storage/managed_value_store_cache.cc2
-rw-r--r--chrome/browser/policy/DEPS26
-rw-r--r--chrome/browser/policy/cloud/DEPS1
-rw-r--r--chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc2
-rw-r--r--chrome/browser/policy/policy_domain_descriptor.cc2
-rw-r--r--chrome/browser/policy/policy_domain_descriptor_unittest.cc2
-rw-r--r--chrome/browser/policy/policy_loader_mac.cc2
-rw-r--r--chrome/browser/policy/policy_service_impl_unittest.cc2
-rw-r--r--chrome/browser/ui/webui/policy_ui.cc2
-rw-r--r--chrome/chrome_common.gypi3
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--chrome/common/DEPS1
-rw-r--r--chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc2
-rw-r--r--components/OWNERS7
-rw-r--r--components/components.gyp1
-rw-r--r--components/components_tests.gypi8
-rw-r--r--components/policy.gypi41
-rw-r--r--components/policy/OWNERS (renamed from chrome/common/policy/OWNERS)1
-rw-r--r--components/policy/core/common/policy_schema.cc (renamed from chrome/common/policy/policy_schema.cc)2
-rw-r--r--components/policy/core/common/policy_schema.h (renamed from chrome/common/policy/policy_schema.h)9
-rw-r--r--components/policy/core/common/policy_schema_unittest.cc (renamed from chrome/common/policy/policy_schema_unittest.cc)3
-rw-r--r--components/policy/policy_export.h29
-rw-r--r--components/policy/stub_to_remove.cc6
24 files changed, 110 insertions, 46 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 09f2cd0..6b18145 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -12,6 +12,7 @@ include_rules = [
"+components/browser_context_keyed_service",
"+components/nacl/common",
"+components/navigation_interception",
+ "+components/policy",
"+components/user_prefs",
"+components/visitedlink/browser",
"+components/webdata",
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index 6184cfc..3b3b15b 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -29,7 +29,7 @@
#include "chrome/common/extensions/extension_set.h"
#include "chrome/common/extensions/manifest.h"
#include "chrome/common/extensions/permissions/api_permission.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
diff --git a/chrome/browser/policy/DEPS b/chrome/browser/policy/DEPS
index 37874c3..b3df281 100644
--- a/chrome/browser/policy/DEPS
+++ b/chrome/browser/policy/DEPS
@@ -74,25 +74,8 @@ specific_include_rules = {
"+chrome/common/pref_names.h",
],
- r"policy_domain_descriptor\.cc": [
- "+chrome/common/policy/policy_schema.h",
- ],
-
- r"policy_domain_descriptor_unittest\.cc": [
- "+chrome/common/policy/policy_schema.h",
- ],
-
- r"policy_loader_mac\.cc": [
- "+chrome/common/policy/policy_schema.h",
- ],
-
- r"policy_loader_win\.cc": [
- "+chrome/common/json_schema/json_schema_constants.h",
- ],
-
r"policy_loader_win_unittest\.cc": [
"+chrome/common/chrome_paths.h",
- "+chrome/common/json_schema/json_schema_constants.h",
],
r"policy_path_parser_win\.cc": [
@@ -100,7 +83,6 @@ specific_include_rules = {
],
r"policy_service_impl_unittest\.cc": [
- "+chrome/common/policy/policy_schema.h",
"+content/public/browser/browser_thread.h",
"+content/public/test/test_browser_thread_bundle.h",
],
@@ -118,14 +100,6 @@ specific_include_rules = {
"+chrome/common/chrome_paths.h",
],
- r"registry_dict_win\.cc": [
- "+chrome/common/json_schema/json_schema_constants.h",
- ],
-
- r"registry_dict_win_unittest\.cc": [
- "+chrome/common/json_schema/json_schema_constants.h",
- ],
-
r"test/local_policy_test_server\.cc": [
"+chrome/common/chrome_paths.h",
],
diff --git a/chrome/browser/policy/cloud/DEPS b/chrome/browser/policy/cloud/DEPS
index 0f3934a..fdfd970 100644
--- a/chrome/browser/policy/cloud/DEPS
+++ b/chrome/browser/policy/cloud/DEPS
@@ -91,7 +91,6 @@ specific_include_rules = {
],
r"component_cloud_policy_service_unittest\.cc": [
- "+chrome/common/policy/policy_schema.h",
"+content/public/browser/browser_thread.h",
"+content/public/test/test_browser_thread.h",
],
diff --git a/chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc b/chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc
index 5fb06e3..0d95a7c 100644
--- a/chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc
+++ b/chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc
@@ -24,7 +24,7 @@
#include "chrome/browser/policy/policy_types.h"
#include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h"
#include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread.h"
#include "net/url_request/test_url_fetcher_factory.h"
diff --git a/chrome/browser/policy/policy_domain_descriptor.cc b/chrome/browser/policy/policy_domain_descriptor.cc
index 0999062..c841a55 100644
--- a/chrome/browser/policy/policy_domain_descriptor.cc
+++ b/chrome/browser/policy/policy_domain_descriptor.cc
@@ -9,7 +9,7 @@
#include "base/values.h"
#include "chrome/browser/policy/policy_bundle.h"
#include "chrome/browser/policy/policy_map.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
namespace policy {
diff --git a/chrome/browser/policy/policy_domain_descriptor_unittest.cc b/chrome/browser/policy/policy_domain_descriptor_unittest.cc
index 06e103d..9a03f8e 100644
--- a/chrome/browser/policy/policy_domain_descriptor_unittest.cc
+++ b/chrome/browser/policy/policy_domain_descriptor_unittest.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/policy/external_data_manager.h"
#include "chrome/browser/policy/policy_bundle.h"
#include "chrome/browser/policy/policy_map.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace policy {
diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc
index 407ac99..29774f0 100644
--- a/chrome/browser/policy/policy_loader_mac.cc
+++ b/chrome/browser/policy/policy_loader_mac.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/policy/policy_load_status.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/preferences_mac.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "policy/policy_constants.h"
using base::mac::CFCast;
diff --git a/chrome/browser/policy/policy_service_impl_unittest.cc b/chrome/browser/policy/policy_service_impl_unittest.cc
index 364e3c4..dc38412 100644
--- a/chrome/browser/policy/policy_service_impl_unittest.cc
+++ b/chrome/browser/policy/policy_service_impl_unittest.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/policy/mock_configuration_policy_provider.h"
#include "chrome/browser/policy/mock_policy_service.h"
#include "chrome/browser/policy/policy_domain_descriptor.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/ui/webui/policy_ui.cc b/chrome/browser/ui/webui/policy_ui.cc
index c514db3..83958bf 100644
--- a/chrome/browser/ui/webui/policy_ui.cc
+++ b/chrome/browser/ui/webui/policy_ui.cc
@@ -66,7 +66,7 @@
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/common/extensions/manifest.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#endif
namespace em = enterprise_management;
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 7062139..bb2ec2f 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -38,6 +38,7 @@
'<(DEPTH)/chrome/chrome_resources.gyp:theme_resources',
'<(DEPTH)/chrome/common_constants.gyp:common_constants',
'<(DEPTH)/components/components.gyp:json_schema',
+ '<(DEPTH)/components/components.gyp:policy_component',
'<(DEPTH)/components/components.gyp:visitedlink_common',
'<(DEPTH)/content/content.gyp:content_common',
'<(DEPTH)/net/net.gyp:net',
@@ -423,8 +424,6 @@
'common/pepper_flash.h',
'common/pepper_permission_util.cc',
'common/pepper_permission_util.h',
- 'common/policy/policy_schema.cc',
- 'common/policy/policy_schema.h',
'common/pref_names_util.cc',
'common/pref_names_util.h',
'common/print_messages.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 576fa0c..1cc82a0 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1774,7 +1774,6 @@
'common/net/url_fixer_upper_unittest.cc',
'common/net/x509_certificate_model_unittest.cc',
'common/partial_circular_buffer_unittest.cc',
- 'common/policy/policy_schema_unittest.cc',
'common/pref_names_util_unittest.cc',
'common/service_process_util_unittest.cc',
'common/switch_utils_unittest.cc',
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index 7101165..18b6bce 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -4,6 +4,7 @@ include_rules = [
"+chromeos", # For chromeos_switches.h
"+components/autofill/core/common",
"+components/nacl/common",
+ "+components/policy/core/common",
"+device/bluetooth", # For BluetoothPermission
"+device/media_transfer_protocol", # For MediaTransferProtocolManager
"+device/usb", # For UsbDevicePermission
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
index 103b19b..23966d3 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
@@ -17,7 +17,7 @@
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/manifest.h"
#include "chrome/common/extensions/permissions/api_permission.h"
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "extensions/common/install_warning.h"
using extension_manifest_keys::kStorageManagedSchema;
diff --git a/components/OWNERS b/components/OWNERS
index e24fd60..ff02f9e 100644
--- a/components/OWNERS
+++ b/components/OWNERS
@@ -24,6 +24,13 @@ per-file nacl*=sehr@chromium.org
per-file navigation_interception.gypi=joth@chromium.org
per-file navigation_interception.gypi=mkosiba@chromium.org
+per-file policy.gypi=mnissler@chromium.org
+per-file policy.gypi=pastarmovj@chromium.org
+per-file policy.gypi=joaodasilva@chromium.org
+per-file policy.gypi=bartfab@chromium.org
+per-file policy.gypi=atwilson@chromium.org
+per-file policy.gypi=pneubeck@chromium.org
+
per-file sessions.gypi=marja@chromium.org
per-file sessions.gypi=sky@chromium.org
diff --git a/components/components.gyp b/components/components.gyp
index fa458e1..602650c 100644
--- a/components/components.gyp
+++ b/components/components.gyp
@@ -17,6 +17,7 @@
'components_tests.gypi',
'json_schema.gypi',
'navigation_interception.gypi',
+ 'policy.gypi',
'sessions.gypi',
'user_prefs.gypi',
'visitedlink.gypi',
diff --git a/components/components_tests.gypi b/components/components_tests.gypi
index 58b7151..61346d0 100644
--- a/components/components_tests.gypi
+++ b/components/components_tests.gypi
@@ -49,6 +49,9 @@
'../skia/skia.gyp:skia',
'navigation_interception',
+ # Dependencies of policy
+ 'policy_component',
+
# Dependencies of sessions
'../third_party/protobuf/protobuf.gyp:protobuf_lite',
'sessions',
@@ -93,6 +96,11 @@
'ldflags': ['-rdynamic'],
},
}],
+ ['configuration_policy==1', {
+ 'sources': [
+ 'policy/core/common/policy_schema_unittest.cc',
+ ],
+ }],
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
diff --git a/components/policy.gypi b/components/policy.gypi
new file mode 100644
index 0000000..5295ba4
--- /dev/null
+++ b/components/policy.gypi
@@ -0,0 +1,41 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'policy_component',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ 'json_schema',
+ ],
+ 'defines': [
+ 'POLICY_COMPONENT_IMPLEMENTATION',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'conditions': [
+ ['configuration_policy==1', {
+ 'sources': [
+ 'policy/core/common/policy_schema.cc',
+ 'policy/core/common/policy_schema.h',
+ 'policy/policy_export.h',
+ ],
+ }, { # configuration_policy==0
+ # The target 'policy_component' always exists. Later it will include
+ # some stubs when configuration_policy==0. For now this stub file is
+ # compiled so that an output is produced, otherwise the shared build
+ # breaks on iOS.
+ # TODO(joaodasilva): remove this comment and the temporary stub after
+ # moving one of the real stubs. http://crbug.com/271392
+ 'sources': [
+ 'policy/stub_to_remove.cc',
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/chrome/common/policy/OWNERS b/components/policy/OWNERS
index 317a807..dbccb7c3 100644
--- a/chrome/common/policy/OWNERS
+++ b/components/policy/OWNERS
@@ -1,4 +1,3 @@
-# This should match chrome/browser/policy/OWNERS
mnissler@chromium.org
pastarmovj@chromium.org
joaodasilva@chromium.org
diff --git a/chrome/common/policy/policy_schema.cc b/components/policy/core/common/policy_schema.cc
index a3e2e7e..8c3145c 100644
--- a/chrome/common/policy/policy_schema.cc
+++ b/components/policy/core/common/policy_schema.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
diff --git a/chrome/common/policy/policy_schema.h b/components/policy/core/common/policy_schema.h
index 75db591..c48ee6f 100644
--- a/chrome/common/policy/policy_schema.h
+++ b/components/policy/core/common/policy_schema.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_POLICY_POLICY_SCHEMA_H_
-#define CHROME_COMMON_POLICY_POLICY_SCHEMA_H_
+#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_
+#define COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_
#include <map>
#include <string>
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
+#include "components/policy/policy_export.h"
namespace policy {
@@ -19,7 +20,7 @@ typedef std::map<std::string, PolicySchema*> PolicySchemaMap;
// Maps known policy keys to their expected types, and recursively describes
// the known keys within dictionary or list types.
-class PolicySchema {
+class POLICY_EXPORT PolicySchema {
public:
// Parses |schema| as a JSON v3 schema, and additionally verifies that:
@@ -66,4 +67,4 @@ class PolicySchema {
} // namespace policy
-#endif // CHROME_COMMON_POLICY_POLICY_SCHEMA_H_
+#endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SCHEMA_H_
diff --git a/chrome/common/policy/policy_schema_unittest.cc b/components/policy/core/common/policy_schema_unittest.cc
index 9f515a2..bfbdd65 100644
--- a/chrome/common/policy/policy_schema_unittest.cc
+++ b/components/policy/core/common/policy_schema_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/policy/policy_schema.h"
+#include "components/policy/core/common/policy_schema.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -191,4 +191,3 @@ TEST(PolicySchemaTest, ValidSchema) {
}
} // namespace policy
-
diff --git a/components/policy/policy_export.h b/components/policy/policy_export.h
new file mode 100644
index 0000000..47376ac
--- /dev/null
+++ b/components/policy/policy_export.h
@@ -0,0 +1,29 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_POLICY_POLICY_EXPORT_H_
+#define COMPONENTS_POLICY_POLICY_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(POLICY_COMPONENT_IMPLEMENTATION)
+#define POLICY_EXPORT __declspec(dllexport)
+#else
+#define POLICY_EXPORT __declspec(dllimport)
+#endif // defined(BASE_PREFS_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(POLICY_COMPONENT_IMPLEMENTATION)
+#define POLICY_EXPORT __attribute__((visibility("default")))
+#else
+#define POLICY_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define POLICY_EXPORT
+#endif
+
+#endif // COMPONENTS_POLICY_POLICY_EXPORT_H_
diff --git a/components/policy/stub_to_remove.cc b/components/policy/stub_to_remove.cc
new file mode 100644
index 0000000..6e352ac
--- /dev/null
+++ b/components/policy/stub_to_remove.cc
@@ -0,0 +1,6 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// TODO(joaodasilva): remove this file and update the comment on policy.gypi.
+// http://crbug.com/271392