From 3b88dd6ef763d14e8663690e207deb8e6064ac80 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 9 Jan 2019 16:44:44 -0800 Subject: [PATCH] tts was migrated to content https://chromium-review.googlesource.com/c/1341154 https://chromium-review.googlesource.com/c/1351806 https://chromium-review.googlesource.com/c/1352055 --- atom/browser/atom_browser_client.cc | 9 +++++++++ atom/browser/atom_browser_client.h | 1 + chromium_src/BUILD.gn | 13 +++++-------- patches/common/chromium/tts.patch | 14 +++++++++++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 1e55d47118ca..f6237912eb1b 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -94,6 +94,7 @@ #endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER) #if BUILDFLAG(ENABLE_TTS) +#include "chrome/browser/speech/tts_controller_delegate_impl.h" #include "chrome/browser/speech/tts_message_filter.h" #endif // BUILDFLAG(ENABLE_TTS) @@ -367,6 +368,14 @@ AtomBrowserClient::CreateSpeechRecognitionManagerDelegate() { return new AtomSpeechRecognitionManagerDelegate; } +content::TtsControllerDelegate* AtomBrowserClient::GetTtsControllerDelegate() { +#if BUILDFLAG(ENABLE_TTS) + return TtsControllerDelegateImpl::GetInstance(); +#else + return nullptr; +#endif +} + void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host, content::WebPreferences* prefs) { prefs->javascript_enabled = true; diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index 57faff59d8d3..4beef4223ee9 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -74,6 +74,7 @@ class AtomBrowserClient : public content::ContentBrowserClient, service_manager::mojom::ServiceRequest* service_request) override; content::SpeechRecognitionManagerDelegate* CreateSpeechRecognitionManagerDelegate() override; + content::TtsControllerDelegate* GetTtsControllerDelegate() override; void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, content::WebPreferences* prefs) override; SiteInstanceForNavigationType ShouldOverrideSiteInstanceForNavigation( diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index f293db611a20..d5f952c1cdea 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -112,18 +112,15 @@ static_library("chrome") { if (enable_tts) { sources += [ - "//chrome/browser/speech/tts_controller.h", - "//chrome/browser/speech/tts_controller_impl.cc", - "//chrome/browser/speech/tts_controller_impl.h", + "//chrome/browser/speech/tts_controller_delegate_impl.cc", + "//chrome/browser/speech/tts_controller_delegate_impl.h", "//chrome/browser/speech/tts_mac.mm", "//chrome/browser/speech/tts_message_filter.cc", "//chrome/browser/speech/tts_message_filter.h", - "//chrome/browser/speech/tts_platform.cc", - "//chrome/browser/speech/tts_platform.h", + "//chrome/browser/speech/tts_platform.h ", + "//chrome/browser/speech/tts_platform_impl.cc", + "//chrome/browser/speech/tts_platform_impl.h", "//chrome/browser/speech/tts_win.cc", - "//chrome/common/tts_messages.h", - "//chrome/common/tts_utterance_request.cc", - "//chrome/common/tts_utterance_request.h", "//chrome/renderer/tts_dispatcher.cc", "//chrome/renderer/tts_dispatcher.h", ] diff --git a/patches/common/chromium/tts.patch b/patches/common/chromium/tts.patch index f2777f0c03f5..c4822abf38ec 100644 --- a/patches/common/chromium/tts.patch +++ b/patches/common/chromium/tts.patch @@ -132,10 +132,18 @@ index 7ff9a9219beffc015ae8a96303595ee529715819..d2394892c2a0d2b4f88407cd412af143 + browser_context_shutdown_notifier_.reset(); } diff --git a/chrome/browser/speech/tts_message_filter.h b/chrome/browser/speech/tts_message_filter.h -index 2fbbc4b4f2a79eac6b686894f2b6463abe404e50..c4712cebfba0efeb62a9061a997055c94ae41e3e 100644 +index 2fbbc4b4f2a79eac6b686894f2b6463abe404e50..e02c1af7e002a70df5fa925ba758c7c2379ffac5 100644 --- a/chrome/browser/speech/tts_message_filter.h +++ b/chrome/browser/speech/tts_message_filter.h -@@ -21,7 +21,6 @@ class BrowserContext; +@@ -8,6 +8,7 @@ + #include "base/macros.h" + #include "base/memory/weak_ptr.h" + #include "base/synchronization/lock.h" ++#include "components/keyed_service/core/keyed_service_shutdown_notifier.h" + #include "content/public/browser/browser_message_filter.h" + #include "content/public/browser/browser_thread.h" + #include "content/public/browser/notification_observer.h" +@@ -21,7 +22,6 @@ class BrowserContext; struct TtsUtteranceRequest; class TtsMessageFilter : public content::BrowserMessageFilter, @@ -143,7 +151,7 @@ index 2fbbc4b4f2a79eac6b686894f2b6463abe404e50..c4712cebfba0efeb62a9061a997055c9 public content::UtteranceEventDelegate, public content::VoicesChangedDelegate { public: -@@ -63,15 +62,13 @@ class TtsMessageFilter : public content::BrowserMessageFilter, +@@ -63,15 +63,13 @@ class TtsMessageFilter : public content::BrowserMessageFilter, // about to be deleted. bool Valid();