Linux: Remove GTK build dependency (issue #2014)

This commit is contained in:
Marshall Greenblatt 2018-09-06 02:29:45 -07:00
parent a64237bcb0
commit e8e0f1f6c6
4 changed files with 198 additions and 11 deletions

View File

@ -329,6 +329,11 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2256 # https://bitbucket.org/chromiumembedded/cef/issues/2256
'name': 'linux_build', 'name': 'linux_build',
}, },
{
# Linux: Remove GTK build dependency.
# https://bitbucket.org/chromiumembedded/cef/issues/2014
'name': 'linux_gtk_2014',
},
{ {
# Changes necessary to support for chrome extensions: # Changes necessary to support for chrome extensions:
# (a) Add a new ExtensionHost constructor that allows CEF to create the # (a) Add a new ExtensionHost constructor that allows CEF to create the

View File

@ -0,0 +1,170 @@
diff --git build/config/linux/gtk/BUILD.gn build/config/linux/gtk/BUILD.gn
index a2b40d82..fac0c19 100644
--- build/config/linux/gtk/BUILD.gn
+++ build/config/linux/gtk/BUILD.gn
@@ -4,8 +4,10 @@
import("//build/config/linux/gtk/gtk.gni")
import("//build/config/linux/pkg_config.gni")
+import("//build/config/ui.gni")
assert(is_linux, "This file should only be referenced on Linux")
+assert(use_gtk, "This file should only be referenced when GTK is enabled")
# GN doesn't check visibility for configs so we give this an obviously internal
# name to discourage random targets from accidentally depending on this and
diff --git build/config/ui.gni build/config/ui.gni
index 547b42f..0eae347 100644
--- build/config/ui.gni
+++ build/config/ui.gni
@@ -37,6 +37,9 @@ declare_args() {
# True means the UI is built using the "views" framework.
toolkit_views = (is_mac || is_win || is_chromeos || use_aura) &&
!is_chromecast && !is_fuchsia
+
+ # Whether we should use GTK.
+ use_gtk = use_aura && is_linux
}
# Additional dependent variables -----------------------------------------------
diff --git chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
index d44c7fe..5f19923 100644
--- chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
+++ chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h"
#include "base/run_loop.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
@@ -30,6 +31,7 @@
namespace {
+#if !BUILDFLAG(ENABLE_CEF)
ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
if (!window)
return nullptr;
@@ -54,6 +56,7 @@ ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
return ui::NativeTheme::GetInstanceForNativeUi();
}
+#endif // !BUILDFLAG(ENABLE_CEF)
} // namespace
@@ -67,9 +70,11 @@ ChromeBrowserMainExtraPartsViewsLinux::
}
void ChromeBrowserMainExtraPartsViewsLinux::PreEarlyInitialization() {
+#if !BUILDFLAG(ENABLE_CEF)
views::LinuxUI* gtk_ui = BuildGtkUi();
gtk_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow));
views::LinuxUI::SetInstance(gtk_ui);
+#endif
}
void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() {
diff --git chrome/test/BUILD.gn chrome/test/BUILD.gn
index 0e72090..795c02b 100644
--- chrome/test/BUILD.gn
+++ chrome/test/BUILD.gn
@@ -3827,7 +3827,7 @@ test("unit_tests") {
"../browser/ui/input_method/input_method_engine_unittest.cc",
]
}
- if (!is_chromeos && !is_chromecast && is_linux) {
+ if (!is_chromeos && !is_chromecast && is_linux && use_gtk) {
sources +=
[ "../browser/ui/libgtkui/select_file_dialog_impl_gtk_unittest.cc" ]
deps += [ "//build/config/linux/gtk" ]
@@ -3848,7 +3848,7 @@ test("unit_tests") {
if (use_gio) {
configs += [ "//build/linux:gio_config" ]
}
- if (!is_chromeos && !use_ozone && is_linux) {
+ if (!is_chromeos && !use_ozone && is_linux && use_gtk) {
deps += [ "//chrome/browser/ui/libgtkui" ]
}
@@ -4970,7 +4970,7 @@ if (!is_android) {
# suites, it seems like one or another starts timing out too.
"../browser/ui/views/keyboard_access_browsertest.cc",
]
- if (!use_ozone) {
+ if (!use_ozone && use_gtk) {
sources += [
"../browser/ui/libgtkui/select_file_dialog_interactive_uitest.cc",
]
diff --git remoting/host/BUILD.gn remoting/host/BUILD.gn
index 563d831..4795186 100644
--- remoting/host/BUILD.gn
+++ remoting/host/BUILD.gn
@@ -336,7 +336,7 @@ static_library("host") {
"//build/config/linux:xrandr",
]
deps += [ "//remoting/host/linux:x11" ]
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [ "//build/config/linux/gtk" ]
}
} else {
@@ -717,7 +717,7 @@ if (enable_me2me_host) {
deps += [ "//components/policy:generated" ]
}
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [ "//build/config/linux/gtk" ]
}
if ((is_linux && !is_chromeos) || is_mac) {
diff --git remoting/host/it2me/BUILD.gn remoting/host/it2me/BUILD.gn
index c8fa7fa..df82cc2 100644
--- remoting/host/it2me/BUILD.gn
+++ remoting/host/it2me/BUILD.gn
@@ -52,7 +52,7 @@ source_set("common") {
"//remoting/resources",
"//remoting/signaling",
]
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [
"//build/config/linux/gtk",
@@ -246,7 +246,7 @@ if (!is_chromeos && enable_remoting_host) {
}
}
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [ "//build/config/linux/gtk" ]
}
}
diff --git remoting/host/linux/BUILD.gn remoting/host/linux/BUILD.gn
index fa24d0b..3ca8743 100644
--- remoting/host/linux/BUILD.gn
+++ remoting/host/linux/BUILD.gn
@@ -98,7 +98,7 @@ source_set("linux") {
if (use_x11) {
deps += [ ":x11" ]
}
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [ "//build/config/linux/gtk" ]
}
}
diff --git remoting/test/BUILD.gn remoting/test/BUILD.gn
index 2670491..36726033 100644
--- remoting/test/BUILD.gn
+++ remoting/test/BUILD.gn
@@ -197,7 +197,7 @@ if (enable_remoting_host && !is_android && !is_chromeos) {
":it2me_standalone_host",
]
- if (is_desktop_linux) {
+ if (is_desktop_linux && use_gtk) {
deps += [ "//build/config/linux/gtk" ]
}

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 58bfe0e13733..371653fc39e8 100644 index 58bfe0e..981abac 100644
--- chrome/browser/ui/BUILD.gn --- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn
@@ -828,6 +828,7 @@ jumbo_split_static_library("ui") { @@ -828,6 +828,7 @@ jumbo_split_static_library("ui") {
@ -10,8 +10,17 @@ index 58bfe0e13733..371653fc39e8 100644
"//chrome:extra_resources", "//chrome:extra_resources",
"//chrome:resources", "//chrome:resources",
"//chrome:strings", "//chrome:strings",
@@ -2709,7 +2710,7 @@ jumbo_split_static_library("ui") {
"views/frame/native_browser_frame_factory_ozone.cc",
]
} else {
- if (use_aura) {
+ if (use_aura && use_gtk) {
# This is the only component that can interact with gtk.
deps += [ "//chrome/browser/ui/libgtkui" ]
}
diff --git chrome/browser/ui/cocoa/applescript/tab_applescript.mm chrome/browser/ui/cocoa/applescript/tab_applescript.mm diff --git chrome/browser/ui/cocoa/applescript/tab_applescript.mm chrome/browser/ui/cocoa/applescript/tab_applescript.mm
index f0a489a0c3af..1bd1259e47e3 100644 index f0a489a..1bd1259 100644
--- chrome/browser/ui/cocoa/applescript/tab_applescript.mm --- chrome/browser/ui/cocoa/applescript/tab_applescript.mm
+++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
@ -51,7 +60,7 @@ index f0a489a0c3af..1bd1259e47e3 100644
- (void)handlesSaveScriptCommand:(NSScriptCommand*)command { - (void)handlesSaveScriptCommand:(NSScriptCommand*)command {
diff --git chrome/browser/ui/webui/settings/printing_handler.cc chrome/browser/ui/webui/settings/printing_handler.cc diff --git chrome/browser/ui/webui/settings/printing_handler.cc chrome/browser/ui/webui/settings/printing_handler.cc
index 8647b2daf9ea..b070ab3e4b86 100644 index 8647b2d..b070ab3 100644
--- chrome/browser/ui/webui/settings/printing_handler.cc --- chrome/browser/ui/webui/settings/printing_handler.cc
+++ chrome/browser/ui/webui/settings/printing_handler.cc +++ chrome/browser/ui/webui/settings/printing_handler.cc
@@ -6,9 +6,13 @@ @@ -6,9 +6,13 @@
@ -82,7 +91,7 @@ index 8647b2daf9ea..b070ab3e4b86 100644
} // namespace settings } // namespace settings
diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h
index f903429e25e4..cde2124fb18e 100644 index f903429..cde2124 100644
--- chrome/common/chrome_utility_printing_messages.h --- chrome/common/chrome_utility_printing_messages.h
+++ chrome/common/chrome_utility_printing_messages.h +++ chrome/common/chrome_utility_printing_messages.h
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
@ -103,7 +112,7 @@ index f903429e25e4..cde2124fb18e 100644
#endif // CHROME_COMMON_CHROME_UTILITY_PRINTING_MESSAGES_H_ #endif // CHROME_COMMON_CHROME_UTILITY_PRINTING_MESSAGES_H_
diff --git chrome/utility/printing_handler.h chrome/utility/printing_handler.h diff --git chrome/utility/printing_handler.h chrome/utility/printing_handler.h
index 006966fd1c58..db9cd49af2a4 100644 index 006966f..db9cd49 100644
--- chrome/utility/printing_handler.h --- chrome/utility/printing_handler.h
+++ chrome/utility/printing_handler.h +++ chrome/utility/printing_handler.h
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
@ -116,7 +125,7 @@ index 006966fd1c58..db9cd49af2a4 100644
#endif #endif
diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc
index 18df7614a988..9f86016d3e68 100644 index 18df761..9f86016d3 100644
--- components/printing/common/print_messages.cc --- components/printing/common/print_messages.cc
+++ components/printing/common/print_messages.cc +++ components/printing/common/print_messages.cc
@@ -140,7 +140,6 @@ PrintMsg_PrintFrame_Params::PrintMsg_PrintFrame_Params() {} @@ -140,7 +140,6 @@ PrintMsg_PrintFrame_Params::PrintMsg_PrintFrame_Params() {}
@ -133,7 +142,7 @@ index 18df7614a988..9f86016d3e68 100644
} }
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h
index e3c11e1302ff..0ae7dbd8851a 100644 index e3c11e1..0ae7dbd 100644
--- components/printing/common/print_messages.h --- components/printing/common/print_messages.h
+++ components/printing/common/print_messages.h +++ components/printing/common/print_messages.h
@@ -85,7 +85,6 @@ struct PrintMsg_PrintFrame_Params { @@ -85,7 +85,6 @@ struct PrintMsg_PrintFrame_Params {
@ -253,7 +262,7 @@ index e3c11e1302ff..0ae7dbd8851a 100644
#endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
diff --git components/printing/renderer/print_render_frame_helper.cc components/printing/renderer/print_render_frame_helper.cc diff --git components/printing/renderer/print_render_frame_helper.cc components/printing/renderer/print_render_frame_helper.cc
index 86a68c361f06..3cd1008f35b0 100644 index 86a68c3..3cd1008 100644
--- components/printing/renderer/print_render_frame_helper.cc --- components/printing/renderer/print_render_frame_helper.cc
+++ components/printing/renderer/print_render_frame_helper.cc +++ components/printing/renderer/print_render_frame_helper.cc
@@ -340,7 +340,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, @@ -340,7 +340,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame,
@ -429,7 +438,7 @@ index 86a68c361f06..3cd1008f35b0 100644
PrintRenderFrameHelper::PrintPreviewContext::PrintPreviewContext() = default; PrintRenderFrameHelper::PrintPreviewContext::PrintPreviewContext() = default;
diff --git components/printing/renderer/print_render_frame_helper.h components/printing/renderer/print_render_frame_helper.h diff --git components/printing/renderer/print_render_frame_helper.h components/printing/renderer/print_render_frame_helper.h
index d09db4d500ca..83d265cf503e 100644 index d09db4d..83d265c 100644
--- components/printing/renderer/print_render_frame_helper.h --- components/printing/renderer/print_render_frame_helper.h
+++ components/printing/renderer/print_render_frame_helper.h +++ components/printing/renderer/print_render_frame_helper.h
@@ -150,10 +150,8 @@ class PrintRenderFrameHelper @@ -150,10 +150,8 @@ class PrintRenderFrameHelper
@ -511,7 +520,7 @@ index d09db4d500ca..83d265cf503e 100644
bool is_loading_ = false; bool is_loading_ = false;
bool is_scripted_preview_delayed_ = false; bool is_scripted_preview_delayed_ = false;
diff --git components/printing_component_strings.grdp components/printing_component_strings.grdp diff --git components/printing_component_strings.grdp components/printing_component_strings.grdp
index f157cbaec42e..5e3c3caa2aa2 100644 index f157cba..5e3c3ca 100644
--- components/printing_component_strings.grdp --- components/printing_component_strings.grdp
+++ components/printing_component_strings.grdp +++ components/printing_component_strings.grdp
@@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@
@ -526,7 +535,7 @@ index f157cbaec42e..5e3c3caa2aa2 100644
- </if> - </if>
</grit-part> </grit-part>
diff --git components/pwg_encoder/BUILD.gn components/pwg_encoder/BUILD.gn diff --git components/pwg_encoder/BUILD.gn components/pwg_encoder/BUILD.gn
index 96ae254116a9..3697d6034300 100644 index 96ae254..3697d60 100644
--- components/pwg_encoder/BUILD.gn --- components/pwg_encoder/BUILD.gn
+++ components/pwg_encoder/BUILD.gn +++ components/pwg_encoder/BUILD.gn
@@ -4,8 +4,6 @@ @@ -4,8 +4,6 @@

View File

@ -260,6 +260,9 @@ def GetRequiredArgs():
# See https://bugs.chromium.org/p/chromium/issues/detail?id=848100#c4 # See https://bugs.chromium.org/p/chromium/issues/detail?id=848100#c4
result['enable_vulkan'] = False result['enable_vulkan'] = False
# Build without GTK dependencies (see issue #2014).
result['use_gtk'] = False
if platform == 'macosx': if platform == 'macosx':
# Always generate dSYM files. The make_distrib script will fail if # Always generate dSYM files. The make_distrib script will fail if
# enable_dsyms=true is not explicitly set when is_official_build=false. # enable_dsyms=true is not explicitly set when is_official_build=false.