Skip to content

Commit 5ef5d60

Browse files
brencaMarshallOfSound
authored andcommitted
refactor: move color_chooser out of chromium_src (electron#15091)
* chore: move color_chooser out of chromium_src * fix: remove deleted source files * fix: add build flag, patch and build instructions for ColorChooser
1 parent 95696c9 commit 5ef5d60

13 files changed

Lines changed: 127 additions & 423 deletions

File tree

atom/browser/common_web_contents_delegate.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,11 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser(
277277
content::WebContents* web_contents,
278278
SkColor color,
279279
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions) {
280+
#if BUILDFLAG(ENABLE_COLOR_CHOOSER)
280281
return chrome::ShowColorChooser(web_contents, color);
282+
#else
283+
return nullptr;
284+
#endif
281285
}
282286

283287
void CommonWebContentsDelegate::RunFileChooser(

buildflags/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildflag_header("buildflags") {
1616
"ENABLE_PEPPER_FLASH=$enable_pepper_flash",
1717
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
1818
"ENABLE_TTS=$enable_tts",
19+
"ENABLE_COLOR_CHOOSER=$enable_color_chooser",
1920
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
2021
]
2122
}

buildflags/buildflags.gni

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ declare_args() {
1616

1717
enable_tts = true
1818

19+
enable_color_chooser = true
20+
1921
# Provide a fake location provider for mocking
2022
# the geolocation responses. Disable it if you
2123
# need to test with chromium's location provider.

chromium_src/BUILD.gn

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Use of this source code is governed by the MIT license that can be
33
# found in the LICENSE file.
44

5+
import("//build/config/ui.gni")
56
import("//electron/buildflags/buildflags.gni")
67
import("//third_party/widevine/cdm/widevine.gni")
78

@@ -66,6 +67,37 @@ static_library("chrome") {
6667
deps += [ "//ui/snapshot" ]
6768
}
6869

70+
if (enable_color_chooser) {
71+
sources += [
72+
"//chrome/browser/platform_util.cc",
73+
"//chrome/browser/platform_util.h",
74+
"//chrome/browser/ui/browser_dialogs.h",
75+
]
76+
77+
if (use_aura) {
78+
sources += [
79+
"//chrome/browser/platform_util_aura.cc",
80+
"//chrome/browser/ui/views/color_chooser_aura.cc",
81+
"//chrome/browser/ui/views/color_chooser_aura.h",
82+
]
83+
}
84+
85+
if (is_mac) {
86+
sources += [
87+
"//chrome/browser/ui/cocoa/color_chooser_mac.h",
88+
"//chrome/browser/ui/cocoa/color_chooser_mac.mm",
89+
]
90+
}
91+
92+
if (is_win) {
93+
sources += [
94+
"//chrome/browser/ui/views/color_chooser_dialog.cc",
95+
"//chrome/browser/ui/views/color_chooser_dialog.h",
96+
"//chrome/browser/ui/views/color_chooser_win.cc",
97+
]
98+
}
99+
}
100+
69101
if (enable_tts) {
70102
sources += [
71103
"//chrome/browser/speech/tts_controller.h",

chromium_src/chrome/browser/ui/browser_dialogs.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

chromium_src/chrome/browser/ui/views/color_chooser_aura.cc

Lines changed: 0 additions & 69 deletions
This file was deleted.

chromium_src/chrome/browser/ui/views/color_chooser_aura.h

Lines changed: 0 additions & 57 deletions
This file was deleted.

chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc

Lines changed: 0 additions & 83 deletions
This file was deleted.

chromium_src/chrome/browser/ui/views/color_chooser_dialog.h

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)