| Index: chrome/browser/chromeos/audio/audio_mixer_cras.cc
|
| diff --git a/chrome/browser/chromeos/audio/audio_mixer_cras.cc b/chrome/browser/chromeos/audio/audio_mixer_cras.cc
|
| index 17519ca5165d7bab7450d2e9082e9ea8691f97d1..eb9ff783c994e50cc330626b98df85f8fa3bb620 100644
|
| --- a/chrome/browser/chromeos/audio/audio_mixer_cras.cc
|
| +++ b/chrome/browser/chromeos/audio/audio_mixer_cras.cc
|
| @@ -10,11 +10,11 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| +#include "base/callback.h"
|
| #include "base/logging.h"
|
| #include "base/message_loop.h"
|
| #include "base/threading/thread.h"
|
| #include "base/threading/thread_restrictions.h"
|
| -#include "chrome/browser/speech/extension_api/tts_extension_api_chromeos.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| using content::BrowserThread;
|
| @@ -54,14 +54,16 @@ AudioMixerCras::~AudioMixerCras() {
|
| cras_client_destroy(client_);
|
| }
|
|
|
| -void AudioMixerCras::Init() {
|
| +void AudioMixerCras::Init(const base::Closure& on_connected) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!thread_.get()) << "Init() called twice";
|
|
|
| thread_.reset(new base::Thread("AudioMixerCras"));
|
| CHECK(thread_->Start());
|
| thread_->message_loop()->PostTask(
|
| - FROM_HERE, base::Bind(&AudioMixerCras::Connect, base::Unretained(this)));
|
| + FROM_HERE, base::Bind(&AudioMixerCras::Connect,
|
| + base::Unretained(this),
|
| + on_connected));
|
| }
|
|
|
| double AudioMixerCras::GetVolumePercent() {
|
| @@ -139,7 +141,7 @@ void AudioMixerCras::SetCaptureMuteLocked(bool locked) {
|
| ApplyStateIfNeeded();
|
| }
|
|
|
| -void AudioMixerCras::Connect() {
|
| +void AudioMixerCras::Connect(const base::Closure& on_connected) {
|
| DCHECK(MessageLoop::current() == thread_->message_loop());
|
|
|
| // Create the client structure.
|
| @@ -149,18 +151,17 @@ void AudioMixerCras::Connect() {
|
| }
|
|
|
| if (cras_client_connect(client_) != 0) {
|
| - thread_->message_loop()->PostDelayedTask(FROM_HERE,
|
| - base::Bind(&AudioMixerCras::Connect, base::Unretained(this)),
|
| + thread_->message_loop()->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::Bind(&AudioMixerCras::Connect,
|
| + base::Unretained(this),
|
| + on_connected),
|
| base::TimeDelta::FromSeconds(kConnectionRetrySleepSec));
|
| return;
|
| }
|
| client_connected_ = true;
|
|
|
| - // The speech synthesis service shouldn't be initialized until after
|
| - // we get to this point, so we call this function to tell it that it's
|
| - // safe to do TTS now. NotificationService would be cleaner,
|
| - // but it's not available at this point.
|
| - EnableChromeOsTts();
|
| + on_connected.Run();
|
|
|
| ApplyState();
|
| }
|
|
|