Index: chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
index b6908760a76c222cde07533c3e5d0a6c4649dff7..f6c7bcecdf8c318d8b32630dcd0cad19ed477efa 100644 |
--- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
@@ -23,6 +23,7 @@ |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/common/console_message_level.h" |
+#include "net/base/network_change_notifier.h" |
using extensions::EventRouter; |
using extensions::Extension; |
@@ -65,6 +66,9 @@ void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { |
ExtensionSystem::Get(profile)->event_router(); |
DCHECK(event_router); |
+ bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() == |
+ net::NetworkChangeNotifier::CONNECTION_NONE); |
David Tseng
2013/11/04 23:55:17
What happens if you go offline after retrieving vo
dmazzoni
2013/11/05 18:11:14
Yes, that will happen automatically, because when
|
+ |
const ExtensionSet* extensions = service->extensions(); |
ExtensionSet::const_iterator iter; |
for (iter = extensions->begin(); iter != extensions->end(); ++iter) { |
@@ -85,6 +89,10 @@ void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { |
for (size_t i = 0; i < tts_voices->size(); ++i) { |
const extensions::TtsVoice& voice = tts_voices->at(i); |
+ // Don't return remote voices when the system is offline. |
+ if (voice.remote && is_offline) |
+ continue; |
+ |
out_voices->push_back(VoiceData()); |
VoiceData& result_voice = out_voices->back(); |