Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: chrome/browser/speech/tts_chromeos.cc

Issue 2599673005: arc: Use GET_INTERFACE_FOR_METHOD macro (Closed)
Patch Set: Addressed feedback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/speech/tts_chromeos.cc
diff --git a/chrome/browser/speech/tts_chromeos.cc b/chrome/browser/speech/tts_chromeos.cc
index cb7749a692764219bb29b167184cad03927366c0..4387bd0984bfe3b201f00654161377e4aab38853 100644
--- a/chrome/browser/speech/tts_chromeos.cc
+++ b/chrome/browser/speech/tts_chromeos.cc
@@ -9,25 +9,6 @@
#include "components/arc/common/tts.mojom.h"
#include "content/public/browser/browser_thread.h"
-namespace {
-
-// For Speak and Stop.
-constexpr uint32_t kDefaultMinVersion = 0;
-
-// Helper returning an ARC tts instance.
-arc::mojom::TtsInstance* GetArcTts(const std::string& method_name_for_logging,
- uint32_t min_version) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- auto* const arc_service_manager = arc::ArcServiceManager::Get();
- if (!arc_service_manager)
- return nullptr;
-
- return arc_service_manager->arc_bridge_service()->tts()->GetInstanceForMethod(
- method_name_for_logging, min_version);
-}
-
-} // namespace
-
// This class includes extension-based tts through LoadBuiltInTtsExtension and
// native tts through ARC.
class TtsPlatformImplChromeOs : public TtsPlatformImpl {
@@ -55,7 +36,12 @@ class TtsPlatformImplChromeOs : public TtsPlatformImpl {
const std::string& lang,
const VoiceData& voice,
const UtteranceContinuousParameters& params) override {
- arc::mojom::TtsInstance* tts = GetArcTts("Speak", kDefaultMinVersion);
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ auto* const arc_service_manager = arc::ArcServiceManager::Get();
+ if (!arc_service_manager)
+ return false;
+ arc::mojom::TtsInstance* tts = ARC_GET_INSTANCE_FOR_METHOD(
+ arc_service_manager->arc_bridge_service()->tts(), Speak);
if (!tts)
return false;
@@ -69,7 +55,12 @@ class TtsPlatformImplChromeOs : public TtsPlatformImpl {
}
bool StopSpeaking() override {
- arc::mojom::TtsInstance* tts = GetArcTts("Stop", kDefaultMinVersion);
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ auto* const arc_service_manager = arc::ArcServiceManager::Get();
+ if (!arc_service_manager)
+ return false;
+ arc::mojom::TtsInstance* tts = ARC_GET_INSTANCE_FOR_METHOD(
+ arc_service_manager->arc_bridge_service()->tts(), Stop);
if (!tts)
return false;

Powered by Google App Engine
This is Rietveld 408576698