Commit 6b997b28 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[CBCM] Move ReportGenerator to components

Moves the ReportGenerator class from chrome/browser to
components/enterprise so it can be reused by iOS code. As part of this
move, the ReportGenerator constructor now also uses the base
ReportingDelegateFactory instead of the desktop-specific one.

Bug: 1092425
Change-Id: I634f898486bcec349d81425b3b5714f7a2c34328
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2298229
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789378}
parent 3bdd0492
...@@ -3128,8 +3128,6 @@ static_library("browser") { ...@@ -3128,8 +3128,6 @@ static_library("browser") {
"enterprise/reporting/prefs.h", "enterprise/reporting/prefs.h",
"enterprise/reporting/profile_report_generator_desktop.cc", "enterprise/reporting/profile_report_generator_desktop.cc",
"enterprise/reporting/profile_report_generator_desktop.h", "enterprise/reporting/profile_report_generator_desktop.h",
"enterprise/reporting/report_generator.cc",
"enterprise/reporting/report_generator.h",
"enterprise/reporting/report_generator_desktop.cc", "enterprise/reporting/report_generator_desktop.cc",
"enterprise/reporting/report_generator_desktop.h", "enterprise/reporting/report_generator_desktop.h",
"enterprise/reporting/report_scheduler.cc", "enterprise/reporting/report_scheduler.cc",
......
...@@ -210,6 +210,7 @@ source_set("chromeos") { ...@@ -210,6 +210,7 @@ source_set("chromeos") {
"//components/download/content/public", "//components/download/content/public",
"//components/drive", "//components/drive",
"//components/drive:drive_chromeos", "//components/drive:drive_chromeos",
"//components/enterprise",
"//components/exo", "//components/exo",
"//components/feedback", "//components/feedback",
"//components/flags_ui", "//components/flags_ui",
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h"
#include "chrome/browser/chromeos/policy/remote_commands/user_commands_factory_chromeos.h" #include "chrome/browser/chromeos/policy/remote_commands/user_commands_factory_chromeos.h"
#include "chrome/browser/chromeos/policy/wildcard_login_checker.h" #include "chrome/browser/chromeos/policy/wildcard_login_checker.h"
#include "chrome/browser/enterprise/reporting/report_generator.h"
#include "chrome/browser/enterprise/reporting/report_scheduler.h" #include "chrome/browser/enterprise/reporting/report_scheduler.h"
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h" #include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h"
#include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
#include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "components/enterprise/browser/reporting/report_generator.h"
#include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/invalidation/impl/profile_invalidation_provider.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_DESKTOP_H_ #ifndef CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_DESKTOP_H_
#define CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_DESKTOP_H_ #define CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_DESKTOP_H_
#include "chrome/browser/enterprise/reporting/report_generator.h" #include "components/enterprise/browser/reporting/report_generator.h"
#include <memory> #include <memory>
#include <string> #include <string>
......
...@@ -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 "chrome/browser/enterprise/reporting/report_generator.h" #include "components/enterprise/browser/reporting/report_generator.h"
#include <set> #include <set>
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/util/timer/wall_clock_timer.h" #include "base/util/timer/wall_clock_timer.h"
#include "chrome/browser/enterprise/reporting/notification/extension_request_observer_factory.h" #include "chrome/browser/enterprise/reporting/notification/extension_request_observer_factory.h"
#include "chrome/browser/enterprise/reporting/report_generator.h"
#include "chrome/browser/upgrade_detector/build_state_observer.h" #include "chrome/browser/upgrade_detector/build_state_observer.h"
#include "components/enterprise/browser/reporting/report_generator.h"
#include "components/enterprise/browser/reporting/report_uploader.h" #include "components/enterprise/browser/reporting/report_uploader.h"
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/reporting/prefs.h" #include "chrome/browser/enterprise/reporting/prefs.h"
#include "chrome/browser/enterprise/reporting/report_generator.h"
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h" #include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/upgrade_detector/build_state.h" #include "chrome/browser/upgrade_detector/build_state.h"
...@@ -24,6 +23,7 @@ ...@@ -24,6 +23,7 @@
#include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h" #include "chrome/test/base/testing_profile_manager.h"
#include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h" #include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h"
#include "components/enterprise/browser/reporting/report_generator.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h" #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "components/version_info/version_info.h" #include "components/version_info/version_info.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include <memory> #include <memory>
#include "chrome/browser/enterprise/reporting/report_generator.h"
#include "components/enterprise/browser/reporting/browser_report_generator.h" #include "components/enterprise/browser/reporting/browser_report_generator.h"
#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "components/enterprise/browser/reporting/profile_report_generator.h"
#include "components/enterprise/browser/reporting/report_generator.h"
namespace enterprise_reporting { namespace enterprise_reporting {
...@@ -32,7 +32,8 @@ class ReportingDelegateFactoryDesktop : public ReportingDelegateFactory { ...@@ -32,7 +32,8 @@ class ReportingDelegateFactoryDesktop : public ReportingDelegateFactory {
std::unique_ptr<ProfileReportGenerator::Delegate> std::unique_ptr<ProfileReportGenerator::Delegate>
GetProfileReportGeneratorDelegate() override; GetProfileReportGeneratorDelegate() override;
std::unique_ptr<ReportGenerator::Delegate> GetReportGeneratorDelegate(); std::unique_ptr<ReportGenerator::Delegate> GetReportGeneratorDelegate()
override;
}; };
} // namespace enterprise_reporting } // namespace enterprise_reporting
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "chrome/browser/device_identity/device_identity_provider.h" #include "chrome/browser/device_identity/device_identity_provider.h"
#include "chrome/browser/device_identity/device_oauth2_token_service.h" #include "chrome/browser/device_identity/device_oauth2_token_service.h"
#include "chrome/browser/device_identity/device_oauth2_token_service_factory.h" #include "chrome/browser/device_identity/device_oauth2_token_service_factory.h"
#include "chrome/browser/enterprise/reporting/report_generator.h"
#include "chrome/browser/enterprise/reporting/report_scheduler.h" #include "chrome/browser/enterprise/reporting/report_scheduler.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/net/system_network_context_manager.h"
...@@ -36,6 +35,7 @@ ...@@ -36,6 +35,7 @@
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "components/enterprise/browser/controller/browser_dm_token_storage.h" #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_helper.h" #include "components/enterprise/browser/controller/chrome_browser_cloud_management_helper.h"
#include "components/enterprise/browser/reporting/report_generator.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/invalidation/impl/fcm_invalidation_service.h" #include "components/invalidation/impl/fcm_invalidation_service.h"
#include "components/invalidation/impl/fcm_network_handler.h" #include "components/invalidation/impl/fcm_network_handler.h"
......
...@@ -14,6 +14,8 @@ static_library("enterprise") { ...@@ -14,6 +14,8 @@ static_library("enterprise") {
"browser/reporting/policy_info.h", "browser/reporting/policy_info.h",
"browser/reporting/profile_report_generator.cc", "browser/reporting/profile_report_generator.cc",
"browser/reporting/profile_report_generator.h", "browser/reporting/profile_report_generator.h",
"browser/reporting/report_generator.cc",
"browser/reporting/report_generator.h",
"browser/reporting/report_request_definition.h", "browser/reporting/report_request_definition.h",
"browser/reporting/report_request_queue_generator.cc", "browser/reporting/report_request_queue_generator.cc",
"browser/reporting/report_request_queue_generator.h", "browser/reporting/report_request_queue_generator.h",
......
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
// 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 "chrome/browser/enterprise/reporting/report_generator.h" #include "components/enterprise/browser/reporting/report_generator.h"
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h" #include "build/build_config.h"
#include "components/enterprise/browser/reporting/browser_report_generator.h"
#include "components/enterprise/browser/reporting/reporting_delegate_factory.h"
#include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/core/common/cloud/cloud_policy_util.h"
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -19,8 +21,7 @@ namespace em = enterprise_management; ...@@ -19,8 +21,7 @@ namespace em = enterprise_management;
namespace enterprise_reporting { namespace enterprise_reporting {
ReportGenerator::ReportGenerator( ReportGenerator::ReportGenerator(ReportingDelegateFactory* delegate_factory)
ReportingDelegateFactoryDesktop* delegate_factory)
: delegate_(delegate_factory->GetReportGeneratorDelegate()), : delegate_(delegate_factory->GetReportGeneratorDelegate()),
report_request_queue_generator_(delegate_factory), report_request_queue_generator_(delegate_factory),
browser_report_generator_(delegate_factory) {} browser_report_generator_(delegate_factory) {}
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// 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 CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_H_ #ifndef COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_GENERATOR_H_
#define CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_H_ #define COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_GENERATOR_H_
#include <memory> #include <memory>
#include <queue> #include <queue>
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "components/enterprise/browser/reporting/browser_report_generator.h" #include "components/enterprise/browser/reporting/browser_report_generator.h"
#include "components/enterprise/browser/reporting/report_request_definition.h" #include "components/enterprise/browser/reporting/report_request_definition.h"
#include "components/enterprise/browser/reporting/report_request_queue_generator.h" #include "components/enterprise/browser/reporting/report_request_queue_generator.h"
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
namespace enterprise_reporting { namespace enterprise_reporting {
class ReportingDelegateFactoryDesktop; class ReportingDelegateFactory;
class ReportGenerator { class ReportGenerator {
public: public:
...@@ -41,7 +40,7 @@ class ReportGenerator { ...@@ -41,7 +40,7 @@ class ReportGenerator {
virtual void SetAndroidAppInfos(ReportRequest* basic_request) = 0; virtual void SetAndroidAppInfos(ReportRequest* basic_request) = 0;
}; };
explicit ReportGenerator(ReportingDelegateFactoryDesktop* delegate_factory); explicit ReportGenerator(ReportingDelegateFactory* delegate_factory);
virtual ~ReportGenerator(); virtual ~ReportGenerator();
// Asynchronously generates a queue of report requests, providing them to // Asynchronously generates a queue of report requests, providing them to
...@@ -91,4 +90,4 @@ class ReportGenerator { ...@@ -91,4 +90,4 @@ class ReportGenerator {
} // namespace enterprise_reporting } // namespace enterprise_reporting
#endif // CHROME_BROWSER_ENTERPRISE_REPORTING_REPORT_GENERATOR_H_ #endif // COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_GENERATOR_H_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "components/enterprise/browser/reporting/browser_report_generator.h" #include "components/enterprise/browser/reporting/browser_report_generator.h"
#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "components/enterprise/browser/reporting/profile_report_generator.h"
#include "components/enterprise/browser/reporting/report_generator.h"
namespace enterprise_reporting { namespace enterprise_reporting {
...@@ -25,6 +26,9 @@ class ReportingDelegateFactory { ...@@ -25,6 +26,9 @@ class ReportingDelegateFactory {
virtual std::unique_ptr<ProfileReportGenerator::Delegate> virtual std::unique_ptr<ProfileReportGenerator::Delegate>
GetProfileReportGeneratorDelegate() = 0; GetProfileReportGeneratorDelegate() = 0;
virtual std::unique_ptr<ReportGenerator::Delegate>
GetReportGeneratorDelegate() = 0;
}; };
} // namespace enterprise_reporting } // namespace enterprise_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