From e77ed6f1686dab1852106d2ffa5f74e7526dbce9 Mon Sep 17 00:00:00 2001
From: Peter Varga <pvarga@inf.u-szeged.hu>
Date: Wed, 17 Oct 2018 10:15:32 +0200
Subject: [PATCH] Clean up header includes in core

Change-Id: I3ffc92eacf30265ecb80061870d213e521e4f838
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 src/core/content_browser_client_qt.cpp  |  7 ++-----
 src/core/content_browser_client_qt.h    |  3 +++
 src/core/render_widget_host_view_qt.cpp | 21 +++++----------------
 src/core/web_engine_context.cpp         |  1 -
 4 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 03f5a10fb..83b4e7cb5 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -72,7 +72,6 @@
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "printing/buildflags/buildflags.h"
 #include "net/ssl/client_cert_identity.h"
-#include "services/device/public/cpp/geolocation/location_provider.h"
 #include "services/resource_coordinator/public/cpp/process_resource_coordinator.h"
 #include "services/resource_coordinator/public/cpp/resource_coordinator_features.h"
 #include "services/service_manager/public/cpp/connector.h"
@@ -767,14 +766,12 @@ bool ContentBrowserClientQt::CanCreateWindow(
     return (settings && settings->getJavaScriptCanOpenWindowsAutomatically()) || user_gesture;
 }
 
+#if QT_CONFIG(webengine_geolocation)
 std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystemLocationProvider()
 {
-#if QT_CONFIG(webengine_geolocation)
     return base::WrapUnique(new LocationProviderQt());
-#else
-    return nullptr;
-#endif
 }
+#endif
 
 scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread()
 {
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 330024831..4d25ddf6a 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -168,7 +168,10 @@ public:
                               content::ResourceContext *context,
                               const std::vector<std::pair<int, int> > &render_frames) override;
 
+#if QT_CONFIG(webengine_geolocation)
     std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider() override;
+#endif
+
 #if defined(Q_OS_LINUX)
     void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override;
 #endif
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index a847d2c99..8439b9cd7 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -39,49 +39,38 @@
 
 #include "render_widget_host_view_qt.h"
 
-#include "common/qt_messages.h"
 #include "browser_accessibility_manager_qt.h"
-#include "browser_accessibility_qt.h"
 #include "chromium_overrides.h"
 #include "compositor.h"
 #include "qtwebenginecoreglobal_p.h"
 #include "render_widget_host_view_qt_delegate.h"
 #include "type_conversion.h"
-#include "web_contents_adapter.h"
 #include "web_contents_adapter_client.h"
 #include "web_event_factory.h"
 
-#include "base/command_line.h"
 #include "components/viz/common/surfaces/frame_sink_id_allocator.h"
-#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
-#include "components/viz/service/display/direct_renderer.h"
-#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
-#include "content/browser/browser_main_loop.h"
 #include "content/browser/frame_host/render_frame_host_impl.h"
 #include "content/browser/frame_host/frame_tree.h"
-#include "content/browser/renderer_host/cursor_manager.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/common/cursors/webcursor.h"
 #include "content/common/input_messages.h"
-#include "content/public/browser/browser_accessibility_state.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/common/content_switches.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/blink/public/platform/web_cursor_info.h"
-#include "ui/base/clipboard/scoped_clipboard_writer.h"
-#include "ui/base/resource/resource_bundle.h"
 #include "ui/events/blink/blink_event_util.h"
 #include "ui/events/event.h"
 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
 #include "ui/events/gesture_detection/motion_event.h"
-#include "ui/events/keycodes/keyboard_codes.h"
 #include "ui/gfx/geometry/size_conversions.h"
-#include "ui/gfx/image/image_skia.h"
+
+#if defined(USE_OZONE)
+#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#endif
 
 #if defined(USE_AURA)
 #include "ui/base/cursor/cursor.h"
 #include "ui/base/cursor/cursors_aura.h"
+#include "ui/base/resource/resource_bundle.h"
 #endif
 
 #include <private/qguiapplication_p.h>
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 6fbdbec61..b7cf1344b 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -53,7 +53,6 @@
 #endif
 #include "components/viz/common/features.h"
 #include "components/web_cache/browser/web_cache_manager.h"
-#include "content/app/content_service_manager_main_delegate.h"
 #include "content/browser/devtools/devtools_http_handler.h"
 #include "content/browser/gpu/gpu_main_thread_factory.h"
 #include "content/browser/renderer_host/render_process_host_impl.h"
-- 
GitLab