Commit f9602834 authored by Julia Tuttle's avatar Julia Tuttle Committed by Commit Bot

Reporting: Check BUILDFLAG(ENABLE_REPORTING) everywhere.

TBR=jochen@chromium.org

Change-Id: Ib27f59fe20674f81a077895c69cff28f753bb705
Reviewed-on: https://chromium-review.googlesource.com/887461Reviewed-by: default avatarJulia Tuttle <juliatuttle@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Julia Tuttle <juliatuttle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532656}
parent a81074e9
......@@ -84,9 +84,7 @@
#include "media/mojo/services/video_decode_perf_history.h"
#include "net/cookies/cookie_store.h"
#include "net/http/http_transaction_factory.h"
#include "net/reporting/reporting_browsing_data_remover.h"
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#include "net/net_features.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/url_util.h"
......@@ -100,18 +98,18 @@
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/offline_pages/core/offline_page_model.h"
#include "sql/connection.h"
#endif
#endif // defined(OS_ANDROID)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/constants.h"
#endif
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#endif
#endif // BUILDFLAG(ENABLE_SESSION_SERVICE)
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
......@@ -120,16 +118,22 @@
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/user_manager/user.h"
#endif
#endif // defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_WEBRTC)
#include "components/webrtc_logging/browser/log_cleanup.h"
#include "components/webrtc_logging/browser/log_list.h"
#endif
#endif // BUILDFLAG(ENABLE_WEBRTC)
#if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
#endif
#endif // BUILDFLAG(ENABLE_PLUGINS)
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/reporting/reporting_browsing_data_remover.h"
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
using base::UserMetricsAction;
using content::BrowserContext;
......@@ -255,6 +259,7 @@ void ClearHttpAuthCacheOnIOThread(
http_session->CloseAllConnections();
}
#if BUILDFLAG(ENABLE_REPORTING)
void ClearReportingCacheOnIOThread(
net::URLRequestContextGetter* context,
int data_type_mask,
......@@ -277,6 +282,7 @@ void ClearNetworkErrorLoggingOnIOThread(
if (delegate)
delegate->RemoveBrowsingData(origin_filter);
}
#endif // BUILDFLAG(ENABLE_REPORTING)
#if defined(OS_ANDROID)
void ClearPrecacheInBackground(content::BrowserContext* browser_context) {
......@@ -1042,6 +1048,7 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
}
}
#if BUILDFLAG(ENABLE_REPORTING)
if ((remove_mask & content::BrowsingDataRemover::DATA_TYPE_COOKIES) ||
(remove_mask & DATA_TYPE_HISTORY)) {
scoped_refptr<net::URLRequestContextGetter> context =
......@@ -1072,6 +1079,8 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
base::RetainedRef(std::move(context)), filter),
UIThreadTrampoline(CreatePendingTaskCompletionClosure()));
}
#endif // BUILDFLAG(ENABLE_REPORTING)
//////////////////////////////////////////////////////////////////////////////
// DATA_TYPE_WEB_APP_DATA
#if defined(OS_ANDROID)
......
......@@ -81,10 +81,7 @@
#include "content/public/test/test_utils.h"
#include "net/cookies/cookie_store.h"
#include "net/http/http_transaction_factory.h"
#include "net/reporting/reporting_browsing_data_remover.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#include "net/net_features.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/skia/include/core/SkBitmap.h"
......@@ -93,9 +90,9 @@
#if defined(OS_ANDROID)
#include "chrome/browser/android/search_permissions/search_permissions_service.h"
#include "chrome/browser/android/webapps/webapp_registry.h"
#else
#else // !defined(OS_ANDROID)
#include "content/public/browser/host_zoom_map.h"
#endif
#endif // !defined(OS_ANDROID)
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
......@@ -103,15 +100,22 @@
#include "chromeos/dbus/fake_cryptohome_client.h"
#include "components/signin/core/account_id/account_id.h"
#include "components/user_manager/scoped_user_manager.h"
#endif
#endif // defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/mock_extension_special_storage_policy.h"
#endif
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h"
#endif
#endif // BUILDFLAG(ENABLE_PLUGINS)
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/reporting/reporting_browsing_data_remover.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
using content::BrowsingDataFilterBuilder;
using domain_reliability::CLEAR_BEACONS;
......@@ -918,6 +922,7 @@ class RemoveAutofillTester : public autofill::PersonalDataManagerObserver {
DISALLOW_COPY_AND_ASSIGN(RemoveAutofillTester);
};
#if BUILDFLAG(ENABLE_REPORTING)
class MockReportingService : public net::ReportingService {
public:
MockReportingService() = default;
......@@ -1079,6 +1084,7 @@ class ClearNetworkErrorLoggingTester {
DISALLOW_COPY_AND_ASSIGN(ClearNetworkErrorLoggingTester);
};
#endif // BUILDFLAG(ENABLE_REPORTING)
// Implementation of the TestingProfile that provides an SSLHostStateDelegate
// which is required for the tests.
......@@ -2581,6 +2587,7 @@ TEST_F(ChromeBrowsingDataRemoverDelegateTest, OriginTypeMasksNoPolicy) {
#endif
}
#if BUILDFLAG(ENABLE_REPORTING)
TEST_F(ChromeBrowsingDataRemoverDelegateTest, ReportingCache_NoService) {
ClearReportingCacheTester tester(GetProfile(), false);
......@@ -2783,6 +2790,7 @@ TEST_F(ChromeBrowsingDataRemoverDelegateTest, NetworkErrorLogging_History) {
EXPECT_TRUE(ProbablySameFilters(BrowsingDataFilterBuilder::BuildNoopFilter(),
origin_filter));
}
#endif // BUILDFLAG(ENABLE_REPORTING)
// Test that all WebsiteSettings are getting deleted by creating a
// value for each of them and removing data.
......
......@@ -33,9 +33,7 @@
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties_impl.h"
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/net_features.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/url_request/url_request_context.h"
......@@ -47,6 +45,12 @@
#include "extensions/common/extension.h"
#endif
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
using content::BrowserThread;
OffTheRecordProfileIOData::Handle::Handle(Profile* profile)
......@@ -280,6 +284,7 @@ net::URLRequestContext* OffTheRecordProfileIOData::InitializeAppRequestContext(
std::move(protocol_handler_interceptor), context->network_delegate(),
context->host_resolver());
context->SetJobFactory(std::move(top_job_factory));
#if BUILDFLAG(ENABLE_REPORTING)
if (context->reporting_service()) {
context->SetReportingService(net::ReportingService::Create(
context->reporting_service()->GetPolicy(), context));
......@@ -290,6 +295,7 @@ net::URLRequestContext* OffTheRecordProfileIOData::InitializeAppRequestContext(
context->network_error_logging_delegate()->SetReportingService(
context->reporting_service());
}
#endif // BUILDFLAG(ENABLE_REPORTING)
return context;
}
......
......@@ -50,6 +50,7 @@
#include "extensions/common/value_builder.h"
#include "net/base/net_errors.h"
#include "net/dns/mock_host_resolver.h"
#include "net/net_features.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
......@@ -556,6 +557,7 @@ void CompareURLRequestContexts(
EXPECT_NE(extension_context->channel_id_service(),
main_context->channel_id_service());
EXPECT_NE(extension_context->cookie_store(), main_context->cookie_store());
#if BUILDFLAG(ENABLE_REPORTING)
if (extension_context->reporting_service()) {
EXPECT_NE(extension_context->reporting_service(),
main_context->reporting_service());
......@@ -564,6 +566,7 @@ void CompareURLRequestContexts(
EXPECT_NE(extension_context->network_error_logging_delegate(),
main_context->network_error_logging_delegate());
}
#endif // BUILDFLAG(ENABLE_REPORTING)
// Check that the ChannelIDService in the HttpNetworkSession is the same as
// the one directly on the URLRequestContext.
......@@ -586,10 +589,12 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, URLRequestContextIsolation) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
#if BUILDFLAG(ENABLE_REPORTING)
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
{network::features::kReporting, network::features::kNetworkErrorLogging},
{});
#endif // BUILDFLAG(ENABLE_REPORTING)
MockProfileDelegate delegate;
EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true));
......@@ -628,10 +633,12 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest,
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
#if BUILDFLAG(ENABLE_REPORTING)
base::test::ScopedFeatureList feature_list;
feature_list.InitWithFeatures(
{network::features::kReporting, network::features::kNetworkErrorLogging},
{});
#endif // BUILDFLAG(ENABLE_REPORTING)
MockProfileDelegate delegate;
EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true));
......
......@@ -68,9 +68,7 @@
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_server_properties_manager.h"
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/net_features.h"
#include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
......@@ -82,6 +80,12 @@
#include "chrome/browser/offline_pages/offline_page_request_interceptor.h"
#endif
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
namespace {
// Returns the BackendType that the disk cache should use.
......@@ -613,6 +617,7 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
context->host_resolver()));
context->SetJobFactory(std::move(top_job_factory));
#if BUILDFLAG(ENABLE_REPORTING)
if (context->reporting_service()) {
context->SetReportingService(net::ReportingService::Create(
context->reporting_service()->GetPolicy(), context));
......@@ -624,6 +629,7 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
context->network_error_logging_delegate()->SetReportingService(
context->reporting_service());
}
#endif // BUILDFLAG(ENABLE_REPORTING)
return context;
}
......
......@@ -98,14 +98,12 @@
#include "net/http/transport_security_persister.h"
#include "net/net_features.h"
#include "net/nqe/network_quality_estimator.h"
#include "net/reporting/reporting_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/client_cert_store.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/network_error_logging_delegate.h"
#include "net/url_request/report_sender.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
......@@ -124,7 +122,7 @@
#include "extensions/browser/extension_throttle_manager.h"
#include "extensions/browser/info_map.h"
#include "extensions/common/constants.h"
#endif
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if defined(OS_ANDROID)
#include "content/public/browser/android/content_protocol_handler.h"
......@@ -161,15 +159,20 @@
#if defined(USE_NSS_CERTS)
#include "chrome/browser/ui/crypto_module_delegate_nss.h"
#include "net/ssl/client_cert_store_nss.h"
#endif
#endif // defined(USE_NSS_CERTS)
#if defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#endif
#endif // defined(OS_WIN)
#if defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#endif
#endif // defined(OS_MACOSX)
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
using content::BrowserContext;
using content::BrowserThread;
......@@ -623,6 +626,7 @@ void ProfileIOData::AppRequestContext::SetJobFactory(
set_job_factory(job_factory_.get());
}
#if BUILDFLAG(ENABLE_REPORTING)
void ProfileIOData::AppRequestContext::SetReportingService(
std::unique_ptr<net::ReportingService> reporting_service) {
reporting_service_ = std::move(reporting_service);
......@@ -635,10 +639,13 @@ void ProfileIOData::AppRequestContext::SetNetworkErrorLoggingDelegate(
network_error_logging_delegate_ = std::move(network_error_logging_delegate);
set_network_error_logging_delegate(network_error_logging_delegate_.get());
}
#endif // BUILDFLAG(ENABLE_REPORTING)
ProfileIOData::AppRequestContext::~AppRequestContext() {
#if BUILDFLAG(ENABLE_REPORTING)
SetNetworkErrorLoggingDelegate(nullptr);
SetReportingService(nullptr);
#endif // BUILDFLAG(ENABLE_REPORTING)
AssertNoURLRequests();
}
......
......@@ -33,6 +33,7 @@
#include "net/cookies/cookie_store.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
#include "net/net_features.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_factory.h"
......@@ -81,12 +82,15 @@ class ChannelIDService;
class ClientCertStore;
class CookieStore;
class HttpTransactionFactory;
class NetworkErrorLoggingDelegate;
class ReportingService;
class ReportSender;
class SSLConfigService;
class URLRequestContextBuilder;
class URLRequestJobFactoryImpl;
#if BUILDFLAG(ENABLE_REPORTING)
class NetworkErrorLoggingDelegate;
class ReportingService;
#endif // BUILDFLAG(ENABLE_REPORTING)
} // namespace net
namespace policy {
......@@ -299,11 +303,13 @@ class ProfileIOData {
void SetHttpTransactionFactory(
std::unique_ptr<net::HttpTransactionFactory> http_factory);
void SetJobFactory(std::unique_ptr<net::URLRequestJobFactory> job_factory);
#if BUILDFLAG(ENABLE_REPORTING)
void SetReportingService(
std::unique_ptr<net::ReportingService> reporting_service);
void SetNetworkErrorLoggingDelegate(
std::unique_ptr<net::NetworkErrorLoggingDelegate>
network_error_logging_delegate);
#endif // BUILDFLAG(ENABLE_REPORTING)
private:
~AppRequestContext() override;
......@@ -313,9 +319,11 @@ class ProfileIOData {
std::unique_ptr<net::HttpNetworkSession> http_network_session_;
std::unique_ptr<net::HttpTransactionFactory> http_factory_;
std::unique_ptr<net::URLRequestJobFactory> job_factory_;
#if BUILDFLAG(ENABLE_REPORTING)
std::unique_ptr<net::ReportingService> reporting_service_;
std::unique_ptr<net::NetworkErrorLoggingDelegate>
network_error_logging_delegate_;
#endif // BUILDFLAG(ENABLE_REPORTING)
};
// Created on the UI thread, read on the IO thread during ProfileIOData lazy
......
......@@ -10,6 +10,7 @@ import("//build/config/ui.gni")
import("//content/public/common/zygote_features.gni")
import("//gpu/vulkan/features.gni")
import("//media/media_options.gni")
import("//net/features.gni")
import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
import("//third_party/WebKit/public/public_features.gni")
......@@ -1150,8 +1151,6 @@ jumbo_source_set("browser") {
"net/network_quality_observer_impl.h",
"net/quota_policy_cookie_store.cc",
"net/quota_policy_cookie_store.h",
"net/reporting_service_proxy.cc",
"net/reporting_service_proxy.h",
"net/view_blob_internals_job_factory.cc",
"net/view_blob_internals_job_factory.h",
"net/view_http_cache_job_factory.cc",
......@@ -2320,6 +2319,13 @@ jumbo_source_set("browser") {
if (use_zygote_handle) {
sources += [ "zygote_host/zygote_handle_linux.cc" ]
}
if (enable_reporting) {
sources += [
"net/reporting_service_proxy.cc",
"net/reporting_service_proxy.h",
]
}
}
buildflag_header("accessibility_flags") {
......
......@@ -101,7 +101,6 @@
#include "content/browser/memory/memory_coordinator_impl.h"
#include "content/browser/mime_registry_impl.h"
#include "content/browser/mus_util.h"
#include "content/browser/net/reporting_service_proxy.h"
#include "content/browser/notifications/notification_message_filter.h"
#include "content/browser/payments/payment_manager.h"
#include "content/browser/permissions/permission_service_context.h"
......@@ -273,6 +272,10 @@
#define IntToStringType base::IntToString
#endif
#if BUILDFLAG(ENABLE_REPORTING)
#include "content/browser/net/reporting_service_proxy.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
namespace content {
namespace {
......@@ -1924,8 +1927,10 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
registry->AddInterface(
base::Bind(&metrics::CreateSingleSampleMetricsProvider));
#if BUILDFLAG(ENABLE_REPORTING)
registry->AddInterface(
base::Bind(&CreateReportingServiceProxy, storage_partition_impl_));
#endif // BUILDFLAG(ENABLE_REPORTING)
registry->AddInterface(base::BindRepeating(
&AppCacheDispatcherHost::Create,
......
......@@ -32,10 +32,9 @@
#include "net/dns/host_resolver.h"
#include "net/dns/mapped_host_resolver.h"
#include "net/http/http_network_session.h"
#include "net/net_features.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/url_request/url_request_context.h"
......@@ -44,6 +43,11 @@
#include "services/network/public/cpp/network_switches.h"
#include "url/url_constants.h"
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
namespace content {
namespace {
......
......@@ -31,7 +31,6 @@
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source_type.h"
#include "net/reporting/reporting_service.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/url_request/redirect_info.h"
#include "net/url_request/redirect_util.h"
......@@ -45,6 +44,7 @@
#include "url/origin.h"
#if BUILDFLAG(ENABLE_REPORTING)
#include "net/reporting/reporting_service.h"
#include "net/url_request/network_error_logging_delegate.h"
#endif // BUILDFLAG(ENABLE_REPORTING)
......
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