Break dependency of chrome.gyp:common on content.gyp:content_browser.

The dependency path is
  src/chrome/chrome.gyp:common ->
  src/components/components.gyp:policy_component ->
  src/components/components.gyp:user_prefs ->
  src/content/content.gyp:content_browser

This was introduced in https://codereview.chromium.org/102973005. The issue is
that URLBlacklistManager::RegisterProfilePrefs() uses a PrefServiceSyncable
which comes from user_prefs, and user_prefs depends on content::BrowserContext.

This fix splits the policy/common files into a policy_component_common target
that does not depend on user_prefs. chrome.gyp:common now depends on
policy_component_common, and chrome.gyp:browser depends on policy_component.

BUG=332030

Review URL: https://codereview.chromium.org/124393003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243567 0039d316-1c4b-4281-b951-d872f2087c98
parent 6043a0ab
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/task_runner_util.h" #include "base/task_runner_util.h"
#include "base/threading/sequenced_worker_pool.h" #include "base/threading/sequenced_worker_pool.h"
#include "chrome/common/net/url_fixer_upper.h" #include "chrome/common/net/url_fixer_upper.h"
#include "components/policy/core/common/url_blacklist_manager.h" #include "components/policy/core/browser/url_blacklist_manager.h"
#include "components/url_matcher/url_matcher.h" #include "components/url_matcher/url_matcher.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#endif #endif
#if defined(ENABLE_CONFIGURATION_POLICY) #if defined(ENABLE_CONFIGURATION_POLICY)
#include "components/policy/core/common/url_blacklist_manager.h" #include "components/policy/core/browser/url_blacklist_manager.h"
#endif #endif
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/policy/core/common/url_blacklist_manager.h" #include "components/policy/core/browser/url_blacklist_manager.h"
#include <ostream> #include <ostream>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "url/gurl.h" #include "url/gurl.h"
// TODO(joaodasilva): this file should be moved next to // TODO(joaodasilva): this file should be moved next to
// components/policy/core/common/url_blacklist_manager.(cc|h). // components/policy/core/browser/url_blacklist_manager.(cc|h).
// However, url_fixer_upper.h can't be included from the component. Rather // However, url_fixer_upper.h can't be included from the component. Rather
// than having it mocked out, the actual URLFixerUpper::SegmentURL call is used // than having it mocked out, the actual URLFixerUpper::SegmentURL call is used
// to make sure that the parsing of URL filters is correct. // to make sure that the parsing of URL filters is correct.
......
...@@ -106,8 +106,8 @@ ...@@ -106,8 +106,8 @@
#if defined(ENABLE_CONFIGURATION_POLICY) #if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/browser_policy_connector.h"
#include "components/policy/core/browser/url_blacklist_manager.h"
#include "components/policy/core/common/policy_statistics_collector.h" #include "components/policy/core/common/policy_statistics_collector.h"
#include "components/policy/core/common/url_blacklist_manager.h"
#endif #endif
#if defined(ENABLE_MANAGED_USERS) #if defined(ENABLE_MANAGED_USERS)
......
...@@ -80,10 +80,10 @@ ...@@ -80,10 +80,10 @@
#if defined(ENABLE_CONFIGURATION_POLICY) #if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/cloud/policy_header_service_factory.h" #include "chrome/browser/policy/cloud/policy_header_service_factory.h"
#include "chrome/browser/policy/policy_helpers.h" #include "chrome/browser/policy/policy_helpers.h"
#include "components/policy/core/browser/url_blacklist_manager.h"
#include "components/policy/core/common/cloud/policy_header_io_helper.h" #include "components/policy/core/common/cloud/policy_header_io_helper.h"
#include "components/policy/core/common/cloud/policy_header_service.h" #include "components/policy/core/common/cloud/policy_header_service.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/policy/core/common/url_blacklist_manager.h"
#endif #endif
#if defined(ENABLE_MANAGED_USERS) #if defined(ENABLE_MANAGED_USERS)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
'../components/component_strings.gyp:component_strings', '../components/component_strings.gyp:component_strings',
'../components/components.gyp:encryptor', '../components/components.gyp:encryptor',
'../components/components.gyp:navigation_metrics', '../components/components.gyp:navigation_metrics',
'../components/components.gyp:policy_component',
'../components/components.gyp:precache_core', '../components/components.gyp:precache_core',
'../components/components.gyp:signin_core', '../components/components.gyp:signin_core',
'../components/components.gyp:startup_metric_utils', '../components/components.gyp:startup_metric_utils',
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
'<(DEPTH)/chrome/chrome_resources.gyp:theme_resources', '<(DEPTH)/chrome/chrome_resources.gyp:theme_resources',
'<(DEPTH)/chrome/common_constants.gyp:common_constants', '<(DEPTH)/chrome/common_constants.gyp:common_constants',
'<(DEPTH)/components/components.gyp:json_schema', '<(DEPTH)/components/components.gyp:json_schema',
'<(DEPTH)/components/components.gyp:policy_component', '<(DEPTH)/components/components.gyp:policy_component_common',
'<(DEPTH)/components/components.gyp:translate_core_common', '<(DEPTH)/components/components.gyp:translate_core_common',
'<(DEPTH)/components/components.gyp:variations', '<(DEPTH)/components/components.gyp:variations',
'<(DEPTH)/content/content.gyp:content_common', '<(DEPTH)/content/content.gyp:content_common',
......
This diff is collapsed.
include_rules = [ include_rules = [
"+components/json_schema", "+components/json_schema",
"+components/url_matcher",
"+components/user_prefs",
"+crypto", "+crypto",
"+google_apis", "+google_apis",
"+net", "+net",
......
include_rules = [ include_rules = [
"+components/url_matcher",
"+components/user_prefs",
"+grit/component_strings.h", "+grit/component_strings.h",
"+ui/base/l10n", "+ui/base/l10n",
"+ui/base/resource", "+ui/base/resource",
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/policy/core/common/url_blacklist_manager.h" #include "components/policy/core/browser/url_blacklist_manager.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_POLICY_CORE_COMMON_URL_BLACKLIST_MANAGER_H_ #ifndef COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_
#define COMPONENTS_POLICY_CORE_COMMON_URL_BLACKLIST_MANAGER_H_ #define COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_
#include <map> #include <map>
#include <string> #include <string>
...@@ -224,4 +224,4 @@ class POLICY_EXPORT URLBlacklistManager { ...@@ -224,4 +224,4 @@ class POLICY_EXPORT URLBlacklistManager {
} // namespace policy } // namespace policy
#endif // COMPONENTS_POLICY_CORE_COMMON_URL_BLACKLIST_MANAGER_H_ #endif // COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_
# Copyright 2014 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.
{
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_prefs',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../net/net.gyp:net',
'../ui/ui.gyp:ui',
'../url/url.gyp:url_lib',
'component_strings.gyp:component_strings',
'user_prefs',
],
'defines': [
'POLICY_COMPONENT_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
'sources': [
# Note that these sources are always included, even for builds that
# disable policy. Most source files should go in the conditional
# sources list below.
# url_blacklist_manager.h is used by managed mode.
'core/browser/url_blacklist_manager.cc',
'core/browser/url_blacklist_manager.h',
],
'conditions': [
['configuration_policy==1', {
'dependencies': [
'cloud_policy_proto',
'url_matcher',
],
'sources': [
'core/browser/cloud/message_util.cc',
'core/browser/cloud/message_util.h',
'core/browser/configuration_policy_handler.cc',
'core/browser/configuration_policy_handler.h',
'core/browser/configuration_policy_handler_list.cc',
'core/browser/configuration_policy_handler_list.h',
'core/browser/configuration_policy_pref_store.cc',
'core/browser/configuration_policy_pref_store.h',
'core/browser/policy_error_map.cc',
'core/browser/policy_error_map.h',
],
}],
],
}
# Copyright 2014 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.
{
'dependencies': [
'../base/base.gyp:base',
],
'defines': [
'POLICY_COMPONENT_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
'conditions': [
['configuration_policy==1', {
'dependencies': [
'../base/base.gyp:base_prefs',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../google_apis/google_apis.gyp:google_apis',
'../net/net.gyp:net',
'../url/url.gyp:url_lib',
'cloud_policy_proto',
'json_schema',
'policy',
],
'sources': [
'core/common/cloud/cloud_external_data_manager.cc',
'core/common/cloud/cloud_external_data_manager.h',
'core/common/cloud/cloud_policy_client.cc',
'core/common/cloud/cloud_policy_client.h',
'core/common/cloud/cloud_policy_client_registration_helper.cc',
'core/common/cloud/cloud_policy_client_registration_helper.h',
'core/common/cloud/cloud_policy_constants.cc',
'core/common/cloud/cloud_policy_constants.h',
'core/common/cloud/cloud_policy_core.cc',
'core/common/cloud/cloud_policy_core.h',
'core/common/cloud/cloud_policy_manager.cc',
'core/common/cloud/cloud_policy_manager.h',
'core/common/cloud/cloud_policy_refresh_scheduler.cc',
'core/common/cloud/cloud_policy_refresh_scheduler.h',
'core/common/cloud/cloud_policy_service.cc',
'core/common/cloud/cloud_policy_service.h',
'core/common/cloud/cloud_policy_store.cc',
'core/common/cloud/cloud_policy_store.h',
'core/common/cloud/cloud_policy_validator.cc',
'core/common/cloud/cloud_policy_validator.h',
'core/common/cloud/component_cloud_policy_service.cc',
'core/common/cloud/component_cloud_policy_service.h',
'core/common/cloud/component_cloud_policy_store.cc',
'core/common/cloud/component_cloud_policy_store.h',
'core/common/cloud/component_cloud_policy_updater.cc',
'core/common/cloud/component_cloud_policy_updater.h',
'core/common/cloud/device_management_service.cc',
'core/common/cloud/device_management_service.h',
'core/common/cloud/enterprise_metrics.cc',
'core/common/cloud/enterprise_metrics.h',
'core/common/cloud/external_policy_data_fetcher.cc',
'core/common/cloud/external_policy_data_fetcher.h',
'core/common/cloud/external_policy_data_updater.cc',
'core/common/cloud/external_policy_data_updater.h',
'core/common/cloud/policy_header_io_helper.cc',
'core/common/cloud/policy_header_io_helper.h',
'core/common/cloud/policy_header_service.cc',
'core/common/cloud/policy_header_service.h',
'core/common/cloud/rate_limiter.cc',
'core/common/cloud/rate_limiter.h',
'core/common/cloud/resource_cache.cc',
'core/common/cloud/resource_cache.h',
'core/common/cloud/system_policy_request_context.cc',
'core/common/cloud/system_policy_request_context.h',
'core/common/cloud/user_cloud_policy_manager.cc',
'core/common/cloud/user_cloud_policy_manager.h',
'core/common/cloud/user_cloud_policy_store.cc',
'core/common/cloud/user_cloud_policy_store.h',
'core/common/cloud/user_cloud_policy_store_base.cc',
'core/common/cloud/user_cloud_policy_store_base.h',
'core/common/cloud/user_info_fetcher.cc',
'core/common/cloud/user_info_fetcher.h',
'core/common/cloud/user_policy_request_context.cc',
'core/common/cloud/user_policy_request_context.h',
'core/common/async_policy_loader.cc',
'core/common/async_policy_loader.h',
'core/common/async_policy_provider.cc',
'core/common/async_policy_provider.h',
'core/common/config_dir_policy_loader.cc',
'core/common/config_dir_policy_loader.h',
'core/common/configuration_policy_provider.cc',
'core/common/configuration_policy_provider.h',
'core/common/external_data_fetcher.cc',
'core/common/external_data_fetcher.h',
'core/common/external_data_manager.h',
'core/common/forwarding_policy_provider.cc',
'core/common/forwarding_policy_provider.h',
'core/common/policy_bundle.cc',
'core/common/policy_bundle.h',
'core/common/policy_details.h',
'core/common/policy_loader_mac.cc',
'core/common/policy_loader_mac.h',
'core/common/policy_loader_win.cc',
'core/common/policy_loader_win.h',
'core/common/policy_load_status.cc',
'core/common/policy_load_status.h',
'core/common/policy_map.cc',
'core/common/policy_map.h',
'core/common/policy_namespace.cc',
'core/common/policy_namespace.h',
'core/common/policy_pref_names.cc',
'core/common/policy_pref_names.h',
'core/common/policy_service.cc',
'core/common/policy_service.h',
'core/common/policy_service_impl.cc',
'core/common/policy_service_impl.h',
'core/common/policy_statistics_collector.cc',
'core/common/policy_statistics_collector.h',
'core/common/policy_switches.cc',
'core/common/policy_switches.h',
'core/common/policy_types.h',
'core/common/preferences_mac.cc',
'core/common/preferences_mac.h',
'core/common/preg_parser_win.cc',
'core/common/preg_parser_win.h',
'core/common/registry_dict_win.cc',
'core/common/registry_dict_win.h',
'core/common/schema.cc',
'core/common/schema.h',
'core/common/schema_internal.h',
'core/common/schema_map.cc',
'core/common/schema_map.h',
'core/common/schema_registry.cc',
'core/common/schema_registry.h',
'policy_export.h',
],
'conditions': [
['OS=="android"', {
'sources': [
'core/common/cloud/component_cloud_policy_service_stub.cc',
],
'sources!': [
'core/common/async_policy_loader.cc',
'core/common/async_policy_loader.h',
'core/common/async_policy_provider.cc',
'core/common/async_policy_provider.h',
'core/common/cloud/component_cloud_policy_service.cc',
'core/common/cloud/component_cloud_policy_store.cc',
'core/common/cloud/component_cloud_policy_store.h',
'core/common/cloud/component_cloud_policy_updater.cc',
'core/common/cloud/component_cloud_policy_updater.h',
'core/common/cloud/external_policy_data_fetcher.cc',
'core/common/cloud/external_policy_data_fetcher.h',
'core/common/cloud/external_policy_data_updater.cc',
'core/common/cloud/external_policy_data_updater.h',
'core/common/cloud/resource_cache.cc',
'core/common/cloud/resource_cache.h',
'core/common/config_dir_policy_loader.cc',
'core/common/config_dir_policy_loader.h',
'core/common/policy_load_status.cc',
'core/common/policy_load_status.h',
],
}],
['chromeos==1', {
'sources!': [
'core/common/cloud/cloud_policy_client_registration_helper.cc',
'core/common/cloud/cloud_policy_client_registration_helper.h',
'core/common/cloud/user_cloud_policy_manager.cc',
'core/common/cloud/user_cloud_policy_manager.h',
'core/common/cloud/user_cloud_policy_store.cc',
'core/common/cloud/user_cloud_policy_store.h',
],
}],
],
}, { # configuration_policy==0
# Some of the policy code is always enabled, so that other parts of
# Chrome can always interface with the PolicyService without having
# to #ifdef on ENABLE_CONFIGURATION_POLICY.
'sources': [
'core/common/external_data_fetcher.h',
'core/common/external_data_fetcher.cc',
'core/common/external_data_manager.h',
'core/common/policy_map.cc',
'core/common/policy_map.h',
'core/common/policy_namespace.cc',
'core/common/policy_namespace.h',
'core/common/policy_service.cc',
'core/common/policy_service.h',
'core/common/policy_service_stub.cc',
'core/common/policy_service_stub.h',
],
}],
],
}
...@@ -6,24 +6,29 @@ ...@@ -6,24 +6,29 @@
#define COMPONENTS_POLICY_POLICY_EXPORT_H_ #define COMPONENTS_POLICY_POLICY_EXPORT_H_
#if defined(COMPONENT_BUILD) #if defined(COMPONENT_BUILD)
#if defined(WIN32) #if defined(WIN32)
#if defined(POLICY_COMPONENT_IMPLEMENTATION) #if defined(POLICY_COMPONENT_IMPLEMENTATION)
#define POLICY_EXPORT __declspec(dllexport) #define POLICY_EXPORT __declspec(dllexport)
#else #else
#define POLICY_EXPORT __declspec(dllimport) #define POLICY_EXPORT __declspec(dllimport)
#endif // defined(BASE_PREFS_IMPLEMENTATION) #endif // defined(POLICY_COMPONENT_IMPLEMENTATION)
#else // defined(WIN32) #else // defined(WIN32)
#if defined(POLICY_COMPONENT_IMPLEMENTATION) #if defined(POLICY_COMPONENT_IMPLEMENTATION)
#define POLICY_EXPORT __attribute__((visibility("default"))) #define POLICY_EXPORT __attribute__((visibility("default")))
#else #else
#define POLICY_EXPORT #define POLICY_EXPORT
#endif #endif // defined(POLICY_COMPONENT_IMPLEMENTATION)
#endif
#endif // defined(WIN32)
#else // defined(COMPONENT_BUILD) #else // defined(COMPONENT_BUILD)
#define POLICY_EXPORT #define POLICY_EXPORT
#endif
#endif // defined(COMPONENT_BUILD)
#endif // COMPONENTS_POLICY_POLICY_EXPORT_H_ #endif // COMPONENTS_POLICY_POLICY_EXPORT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment