From 5ef5d60f77486419335a47347ee6d14d7101f9bf Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Fri, 12 Oct 2018 01:53:46 +0200 Subject: [PATCH] refactor: move color_chooser out of chromium_src (#15091) * chore: move color_chooser out of chromium_src * fix: remove deleted source files * fix: add build flag, patch and build instructions for ColorChooser --- atom/browser/common_web_contents_delegate.cc | 4 + buildflags/BUILD.gn | 1 + buildflags/buildflags.gni | 2 + chromium_src/BUILD.gn | 32 ++++++ .../chrome/browser/ui/browser_dialogs.h | 26 ----- .../browser/ui/views/color_chooser_aura.cc | 69 ------------ .../browser/ui/views/color_chooser_aura.h | 57 ---------- .../browser/ui/views/color_chooser_dialog.cc | 83 -------------- .../browser/ui/views/color_chooser_dialog.h | 75 ------------- .../browser/ui/views/color_chooser_win.cc | 106 ------------------ filenames.gni | 7 -- patches/common/chromium/.patches.yaml | 14 +++ patches/common/chromium/color_chooser.patch | 74 ++++++++++++ 13 files changed, 127 insertions(+), 423 deletions(-) delete mode 100644 chromium_src/chrome/browser/ui/browser_dialogs.h delete mode 100644 chromium_src/chrome/browser/ui/views/color_chooser_aura.cc delete mode 100644 chromium_src/chrome/browser/ui/views/color_chooser_aura.h delete mode 100644 chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc delete mode 100644 chromium_src/chrome/browser/ui/views/color_chooser_dialog.h delete mode 100644 chromium_src/chrome/browser/ui/views/color_chooser_win.cc create mode 100644 patches/common/chromium/color_chooser.patch diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 340842963354..fdb6627d0ea2 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -277,7 +277,11 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser( content::WebContents* web_contents, SkColor color, const std::vector& suggestions) { +#if BUILDFLAG(ENABLE_COLOR_CHOOSER) return chrome::ShowColorChooser(web_contents, color); +#else + return nullptr; +#endif } void CommonWebContentsDelegate::RunFileChooser( diff --git a/buildflags/BUILD.gn b/buildflags/BUILD.gn index a8b4aaf4bd1f..73e4c1f22f5a 100644 --- a/buildflags/BUILD.gn +++ b/buildflags/BUILD.gn @@ -16,6 +16,7 @@ buildflag_header("buildflags") { "ENABLE_PEPPER_FLASH=$enable_pepper_flash", "ENABLE_PDF_VIEWER=$enable_pdf_viewer", "ENABLE_TTS=$enable_tts", + "ENABLE_COLOR_CHOOSER=$enable_color_chooser", "OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider", ] } diff --git a/buildflags/buildflags.gni b/buildflags/buildflags.gni index efc4af8e8261..2425b927b389 100644 --- a/buildflags/buildflags.gni +++ b/buildflags/buildflags.gni @@ -16,6 +16,8 @@ declare_args() { enable_tts = true + enable_color_chooser = true + # Provide a fake location provider for mocking # the geolocation responses. Disable it if you # need to test with chromium's location provider. diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 6f8c4c19a67b..6602ad13405c 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. +import("//build/config/ui.gni") import("//electron/buildflags/buildflags.gni") import("//third_party/widevine/cdm/widevine.gni") @@ -66,6 +67,37 @@ static_library("chrome") { deps += [ "//ui/snapshot" ] } + if (enable_color_chooser) { + sources += [ + "//chrome/browser/platform_util.cc", + "//chrome/browser/platform_util.h", + "//chrome/browser/ui/browser_dialogs.h", + ] + + if (use_aura) { + sources += [ + "//chrome/browser/platform_util_aura.cc", + "//chrome/browser/ui/views/color_chooser_aura.cc", + "//chrome/browser/ui/views/color_chooser_aura.h", + ] + } + + if (is_mac) { + sources += [ + "//chrome/browser/ui/cocoa/color_chooser_mac.h", + "//chrome/browser/ui/cocoa/color_chooser_mac.mm", + ] + } + + if (is_win) { + sources += [ + "//chrome/browser/ui/views/color_chooser_dialog.cc", + "//chrome/browser/ui/views/color_chooser_dialog.h", + "//chrome/browser/ui/views/color_chooser_win.cc", + ] + } + } + if (enable_tts) { sources += [ "//chrome/browser/speech/tts_controller.h", diff --git a/chromium_src/chrome/browser/ui/browser_dialogs.h b/chromium_src/chrome/browser/ui/browser_dialogs.h deleted file mode 100644 index f6554d4465a1..000000000000 --- a/chromium_src/chrome/browser/ui/browser_dialogs.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ -#define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ - -#include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/native_widget_types.h" - -class SkBitmap; - -namespace content { -class ColorChooser; -class WebContents; -} // namespace content - -namespace chrome { - -// Shows a color chooser that reports to the given WebContents. -content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, - SkColor initial_color); - -} // namespace chrome - -#endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ diff --git a/chromium_src/chrome/browser/ui/views/color_chooser_aura.cc b/chromium_src/chrome/browser/ui/views/color_chooser_aura.cc deleted file mode 100644 index f4dea0baa5a7..000000000000 --- a/chromium_src/chrome/browser/ui/views/color_chooser_aura.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/color_chooser_aura.h" - -#include "chrome/browser/ui/browser_dialogs.h" -#include "content/public/browser/web_contents.h" -#include "ui/views/color_chooser/color_chooser_view.h" -#include "ui/views/widget/widget.h" - -ColorChooserAura::ColorChooserAura(content::WebContents* web_contents, - SkColor initial_color) - : web_contents_(web_contents) { - view_ = new views::ColorChooserView(this, initial_color); - widget_ = views::Widget::CreateWindowWithParent( - view_, web_contents->GetTopLevelNativeWindow()); - widget_->Show(); -} - -void ColorChooserAura::OnColorChosen(SkColor color) { - if (web_contents_) - web_contents_->DidChooseColorInColorChooser(color); -} - -void ColorChooserAura::OnColorChooserDialogClosed() { - view_ = NULL; - widget_ = NULL; - DidEndColorChooser(); -} - -void ColorChooserAura::End() { - if (widget_) { - view_->set_listener(NULL); - widget_->Close(); - view_ = NULL; - widget_ = NULL; - // DidEndColorChooser will invoke Browser::DidEndColorChooser, which deletes - // this. Take care of the call order. - DidEndColorChooser(); - } -} - -void ColorChooserAura::DidEndColorChooser() { - if (web_contents_) - web_contents_->DidEndColorChooser(); -} - -void ColorChooserAura::SetSelectedColor(SkColor color) { - if (view_) - view_->OnColorChanged(color); -} - -// static -ColorChooserAura* ColorChooserAura::Open(content::WebContents* web_contents, - SkColor initial_color) { - return new ColorChooserAura(web_contents, initial_color); -} - -#if !defined(OS_WIN) -namespace chrome { - -content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, - SkColor initial_color) { - return ColorChooserAura::Open(web_contents, initial_color); -} - -} // namespace chrome -#endif // OS_WIN diff --git a/chromium_src/chrome/browser/ui/views/color_chooser_aura.h b/chromium_src/chrome/browser/ui/views/color_chooser_aura.h deleted file mode 100644 index 7e93f5e42d2b..000000000000 --- a/chromium_src/chrome/browser/ui/views/color_chooser_aura.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_ -#define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_ - -#include "base/macros.h" -#include "content/public/browser/color_chooser.h" -#include "ui/views/color_chooser/color_chooser_listener.h" - -namespace content { -class WebContents; -} - -namespace views { -class ColorChooserView; -class Widget; -} // namespace views - -// TODO(mukai): rename this as -Ash and move to c/b/ui/ash after Linux-aura -// switches to its native color chooser. -class ColorChooserAura : public content::ColorChooser, - public views::ColorChooserListener { - public: - static ColorChooserAura* Open(content::WebContents* web_contents, - SkColor initial_color); - - private: - ColorChooserAura(content::WebContents* web_contents, SkColor initial_color); - - // content::ColorChooser overrides: - void End() override; - void SetSelectedColor(SkColor color) override; - - // views::ColorChooserListener overrides: - void OnColorChosen(SkColor color) override; - void OnColorChooserDialogClosed() override; - - void DidEndColorChooser(); - - // The actual view of the color chooser. No ownership because its parent - // view will take care of its lifetime. - views::ColorChooserView* view_; - - // The widget for the color chooser. No ownership because it's released - // automatically when closed. - views::Widget* widget_; - - // The web contents invoking the color chooser. No ownership because it will - // outlive this class. - content::WebContents* web_contents_; - - DISALLOW_COPY_AND_ASSIGN(ColorChooserAura); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_ diff --git a/chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc b/chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc deleted file mode 100644 index 81d853f61df6..000000000000 --- a/chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/color_chooser_dialog.h" - -#include - -#include "base/bind.h" -#include "base/message_loop/message_loop.h" -#include "base/threading/thread.h" -#include "content/public/browser/browser_thread.h" -#include "skia/ext/skia_utils_win.h" -#include "ui/views/color_chooser/color_chooser_listener.h" -#include "ui/views/win/hwnd_util.h" - -using content::BrowserThread; - -// static -COLORREF ColorChooserDialog::g_custom_colors[16]; - -ColorChooserDialog::ExecuteOpenParams::ExecuteOpenParams(SkColor color, - RunState run_state, - HWND owner) - : color(color), run_state(run_state), owner(owner) {} - -ColorChooserDialog::ColorChooserDialog(views::ColorChooserListener* listener, - SkColor initial_color, - gfx::NativeWindow owning_window) - : listener_(listener) { - DCHECK(listener_); - CopyCustomColors(g_custom_colors, custom_colors_); - HWND owning_hwnd = views::HWNDForNativeWindow(owning_window); - ExecuteOpenParams execute_params(initial_color, BeginRun(owning_hwnd), - owning_hwnd); - execute_params.run_state.dialog_thread->task_runner()->PostTask( - FROM_HERE, - base::Bind(&ColorChooserDialog::ExecuteOpen, this, execute_params)); -} - -ColorChooserDialog::~ColorChooserDialog() {} - -bool ColorChooserDialog::IsRunning(gfx::NativeWindow owning_window) const { - return listener_ && - IsRunningDialogForOwner(views::HWNDForNativeWindow(owning_window)); -} - -void ColorChooserDialog::ListenerDestroyed() { - // Our associated listener has gone away, so we shouldn't call back to it if - // our worker thread returns after the listener is dead. - listener_ = NULL; -} - -void ColorChooserDialog::ExecuteOpen(const ExecuteOpenParams& params) { - CHOOSECOLOR cc; - cc.lStructSize = sizeof(CHOOSECOLOR); - cc.hwndOwner = params.owner; - cc.rgbResult = skia::SkColorToCOLORREF(params.color); - cc.lpCustColors = custom_colors_; - cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT; - bool success = !!ChooseColor(&cc); - DisableOwner(cc.hwndOwner); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&ColorChooserDialog::DidCloseDialog, this, success, - skia::COLORREFToSkColor(cc.rgbResult), params.run_state)); -} - -void ColorChooserDialog::DidCloseDialog(bool chose_color, - SkColor color, - RunState run_state) { - EndRun(run_state); - CopyCustomColors(custom_colors_, g_custom_colors); - if (listener_) { - if (chose_color) - listener_->OnColorChosen(color); - listener_->OnColorChooserDialogClosed(); - } -} - -void ColorChooserDialog::CopyCustomColors(COLORREF* src, COLORREF* dst) { - memcpy(dst, src, sizeof(COLORREF) * arraysize(g_custom_colors)); -} diff --git a/chromium_src/chrome/browser/ui/views/color_chooser_dialog.h b/chromium_src/chrome/browser/ui/views/color_chooser_dialog.h deleted file mode 100644 index 850bd7ad3630..000000000000 --- a/chromium_src/chrome/browser/ui/views/color_chooser_dialog.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ -#define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ - -#include "base/memory/ref_counted.h" -#include "chrome/browser/ui/views/color_chooser_dialog.h" -#include "third_party/skia/include/core/SkColor.h" -#include "ui/shell_dialogs/base_shell_dialog.h" -#include "ui/shell_dialogs/base_shell_dialog_win.h" - -namespace views { -class ColorChooserListener; -} - -class ColorChooserDialog - : public base::RefCountedThreadSafe, - public ui::BaseShellDialog, - public ui::BaseShellDialogImpl { - public: - ColorChooserDialog(views::ColorChooserListener* listener, - SkColor initial_color, - gfx::NativeWindow owning_window); - - // BaseShellDialog: - bool IsRunning(gfx::NativeWindow owning_window) const override; - void ListenerDestroyed() override; - - private: - ~ColorChooserDialog() override; - friend class base::RefCountedThreadSafe; - - struct ExecuteOpenParams { - ExecuteOpenParams(SkColor color, RunState run_state, HWND owner); - SkColor color; - RunState run_state; - HWND owner; - }; - - // Called on the dialog thread to show the actual color chooser. This is - // shown modal to |params.owner|. Once it's closed, calls back to - // DidCloseDialog() on the UI thread. - void ExecuteOpen(const ExecuteOpenParams& params); - - // Called on the UI thread when a color chooser is closed. |chose_color| is - // true if the user actually chose a color, in which case |color| is the - // chosen color. Calls back to the |listener_| (if applicable) to notify it - // of the results, and copies the modified array of |custom_colors_| back to - // |g_custom_colors| so future dialogs will see the changes. - void DidCloseDialog(bool chose_color, SkColor color, RunState run_state); - - // Copies the array of colors in |src| to |dst|. - void CopyCustomColors(COLORREF*, COLORREF*); - - // The user's custom colors. Kept process-wide so that they can be persisted - // from one dialog invocation to the next. - static COLORREF g_custom_colors[16]; - - // A copy of the custom colors for the current dialog to display and modify. - // This allows us to safely access the colors even if multiple windows are - // simultaneously showing color choosers (which would cause thread safety - // problems if we gave them direct handles to |g_custom_colors|). - COLORREF custom_colors_[16]; - - // The listener to notify when the user closes the dialog. This may be set to - // NULL before the color chooser is closed, signalling that the listener no - // longer cares about the outcome. - views::ColorChooserListener* listener_; - - DISALLOW_COPY_AND_ASSIGN(ColorChooserDialog); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ diff --git a/chromium_src/chrome/browser/ui/views/color_chooser_win.cc b/chromium_src/chrome/browser/ui/views/color_chooser_win.cc deleted file mode 100644 index 0f8ebfa6366f..000000000000 --- a/chromium_src/chrome/browser/ui/views/color_chooser_win.cc +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include - -#include "chrome/browser/ui/browser_dialogs.h" -#include "chrome/browser/ui/views/color_chooser_aura.h" -#include "chrome/browser/ui/views/color_chooser_dialog.h" -#include "content/public/browser/color_chooser.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host.h" -#include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/web_contents.h" -#include "ui/aura/window.h" -#include "ui/views/color_chooser/color_chooser_listener.h" - -class ColorChooserWin : public content::ColorChooser, - public views::ColorChooserListener { - public: - static ColorChooserWin* Open(content::WebContents* web_contents, - SkColor initial_color); - - ColorChooserWin(content::WebContents* web_contents, SkColor initial_color); - ~ColorChooserWin() override; - - // content::ColorChooser overrides: - void End() override; - void SetSelectedColor(SkColor color) override {} - - // views::ColorChooserListener overrides: - void OnColorChosen(SkColor color) override; - void OnColorChooserDialogClosed() override; - - private: - static ColorChooserWin* current_color_chooser_; - - // The web contents invoking the color chooser. No ownership. because it will - // outlive this class. - content::WebContents* web_contents_; - - // The color chooser dialog which maintains the native color chooser UI. - scoped_refptr color_chooser_dialog_; -}; - -ColorChooserWin* ColorChooserWin::current_color_chooser_ = NULL; - -ColorChooserWin* ColorChooserWin::Open(content::WebContents* web_contents, - SkColor initial_color) { - if (current_color_chooser_) - return NULL; - current_color_chooser_ = new ColorChooserWin(web_contents, initial_color); - return current_color_chooser_; -} - -ColorChooserWin::ColorChooserWin(content::WebContents* web_contents, - SkColor initial_color) - : web_contents_(web_contents) { - gfx::NativeWindow owning_window = web_contents->GetRenderViewHost() - ->GetWidget() - ->GetView() - ->GetNativeView() - ->GetToplevelWindow(); - color_chooser_dialog_ = - new ColorChooserDialog(this, initial_color, owning_window); -} - -ColorChooserWin::~ColorChooserWin() { - // Always call End() before destroying. - DCHECK(!color_chooser_dialog_); -} - -void ColorChooserWin::End() { - // The ColorChooserDialog's listener is going away. Ideally we'd - // programmatically close the dialog at this point. Since that's impossible, - // we instead tell the dialog its listener is going away, so that the dialog - // doesn't try to communicate with a destroyed listener later. (We also tell - // the renderer the dialog is closed, since from the renderer's perspective - // it effectively is.) - OnColorChooserDialogClosed(); -} - -void ColorChooserWin::OnColorChosen(SkColor color) { - if (web_contents_) - web_contents_->DidChooseColorInColorChooser(color); -} - -void ColorChooserWin::OnColorChooserDialogClosed() { - if (color_chooser_dialog_.get()) { - color_chooser_dialog_->ListenerDestroyed(); - color_chooser_dialog_ = NULL; - } - DCHECK(current_color_chooser_ == this); - current_color_chooser_ = NULL; - if (web_contents_) - web_contents_->DidEndColorChooser(); -} - -namespace chrome { - -content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, - SkColor initial_color) { - return ColorChooserWin::Open(web_contents, initial_color); -} - -} // namespace chrome diff --git a/filenames.gni b/filenames.gni index be42b139e15a..18f0e96682d5 100644 --- a/filenames.gni +++ b/filenames.gni @@ -604,10 +604,6 @@ filenames = { "chromium_src/chrome/browser/process_singleton_posix.cc", "chromium_src/chrome/browser/process_singleton_win.cc", "chromium_src/chrome/browser/process_singleton.h", - "chromium_src/chrome/browser/ui/browser_dialogs.h", - "chromium_src/chrome/browser/ui/cocoa/color_chooser_mac.mm", - "chromium_src/chrome/browser/ui/views/color_chooser_aura.cc", - "chromium_src/chrome/browser/ui/views/color_chooser_aura.h", "chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.cc", "chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h", "chromium_src/chrome/common/print_messages.cc", @@ -628,9 +624,6 @@ filenames = { ] lib_sources_win = [ - "chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc", - "chromium_src/chrome/browser/ui/views/color_chooser_dialog.h", - "chromium_src/chrome/browser/ui/views/color_chooser_win.cc", "chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc", "chromium_src/chrome/browser/printing/pdf_to_emf_converter.h", "chromium_src/chrome/utility/printing_handler_win.cc", diff --git a/patches/common/chromium/.patches.yaml b/patches/common/chromium/.patches.yaml index 2428d7e46877..29c5cab68235 100644 --- a/patches/common/chromium/.patches.yaml +++ b/patches/common/chromium/.patches.yaml @@ -507,3 +507,17 @@ patches: * Adds patch in //chrome/browser/speech/tts_message_filter.cc to remove reference to browser context when its signaled for destruction from content layer. +- + author: Heilig Benedek + file: color_chooser.patch + description: | + Removes a couple of stuff from the chromium implementation of ColorChooser + to decouple it from dependencies. + + Most of the stuff removed is actually related to other dialog types that + we don't currently support, but chrome/browser/ui/browser_dialogs.h has + a function for them to create them. Also disables a DCHECK that crashes + the ColorChooser on Windows, that DCHECK most likely is an artifact that + remained in chromium from a long time ago (last update of that part of the + code was around 2012-2013, and this is purely UI, I don't think they have + automated tests for it). diff --git a/patches/common/chromium/color_chooser.patch b/patches/common/chromium/color_chooser.patch new file mode 100644 index 000000000000..48674830b52e --- /dev/null +++ b/patches/common/chromium/color_chooser.patch @@ -0,0 +1,74 @@ +diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h +index f57c1ded416a..59fdd948c3c5 100644 +--- a/chrome/browser/ui/browser_dialogs.h ++++ b/chrome/browser/ui/browser_dialogs.h +@@ -4,7 +4,7 @@ + + #ifndef CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ + #define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ +- ++#if 0 + #include + #include + #include +@@ -17,6 +17,7 @@ + #include "chrome/browser/ui/bookmarks/bookmark_editor.h" + #include "content/public/browser/content_browser_client.h" + #include "content/public/browser/resource_request_info.h" ++#endif + #include "third_party/skia/include/core/SkColor.h" + #include "ui/gfx/native_widget_types.h" + +@@ -66,7 +67,7 @@ struct SelectedFileInfo; + } + + namespace chrome { +- ++#if 0 + // Shows or hides the Task Manager. |browser| can be NULL when called from Ash. + // Returns a pointer to the underlying TableModel, which can be ignored, or used + // for testing. +@@ -129,11 +130,11 @@ void ShowBookmarkAppDialog(content::WebContents* web_contents, + void ShowPWAInstallDialog(content::WebContents* web_contents, + const WebApplicationInfo& web_app_info, + AppInstallationAcceptanceCallback callback); +- ++#endif + // Shows a color chooser that reports to the given WebContents. + content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, + SkColor initial_color); +- ++#if 0 + #if defined(OS_MACOSX) + + // Bridging methods that show/hide the toolkit-views based Task Manager on Mac. +@@ -301,13 +302,13 @@ void ShowChromeCleanerRebootPrompt( + safe_browsing::ChromeCleanerRebootDialogController* dialog_controller); + + #endif // OS_WIN +- ++#endif + } // namespace chrome +- ++#if 0 + void ShowFolderUploadConfirmationDialog( + const base::FilePath& path, + base::OnceCallback&)> callback, + std::vector selected_files, + content::WebContents* web_contents); +- ++#endif + #endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ +diff --git a/chrome/browser/ui/views/color_chooser_win.cc b/chrome/browser/ui/views/color_chooser_win.cc +index 06381ef0e5ca..acb3a6e9e647 100644 +--- a/chrome/browser/ui/views/color_chooser_win.cc ++++ b/chrome/browser/ui/views/color_chooser_win.cc +@@ -91,7 +91,7 @@ void ColorChooserWin::OnColorChooserDialogClosed() { + color_chooser_dialog_->ListenerDestroyed(); + color_chooser_dialog_ = NULL; + } +- DCHECK(current_color_chooser_ == this); ++ // DCHECK(current_color_chooser_ == this); + current_color_chooser_ = NULL; + if (web_contents_) + web_contents_->DidEndColorChooser();