OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/speech/tts_extension_loader_chromeos.h" | 5 #include "chrome/browser/speech/tts_extension_loader_chromeos.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/extensions/component_loader.h" | 9 #include "chrome/browser/extensions/component_loader.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 bool TtsExtensionLoaderChromeOs::LoadTtsExtension() { | 81 bool TtsExtensionLoaderChromeOs::LoadTtsExtension() { |
82 if (tts_state_ == TTS_LOADED || tts_state_ == TTS_LOADING) | 82 if (tts_state_ == TTS_LOADED || tts_state_ == TTS_LOADING) |
83 return false; | 83 return false; |
84 | 84 |
85 // Load the component extension into this profile. | 85 // Load the component extension into this profile. |
86 VLOG(1) << "Loading TTS component extension."; | 86 VLOG(1) << "Loading TTS component extension."; |
87 tts_state_ = TTS_LOADING; | 87 tts_state_ = TTS_LOADING; |
88 ExtensionService* extension_service = profile_->GetExtensionService(); | 88 ExtensionService* extension_service = profile_->GetExtensionService(); |
89 DCHECK(extension_service); | 89 DCHECK(extension_service); |
90 base::FilePath path = | 90 extension_service->component_loader()->AddChromeOsSpeechSynthesisExtension(); |
91 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath); | |
92 extension_service->component_loader()->Add(IDR_SPEECH_SYNTHESIS_MANIFEST, | |
93 path); | |
94 return true; | 91 return true; |
95 } | 92 } |
96 | 93 |
97 void TtsExtensionLoaderChromeOs::Shutdown() { | 94 void TtsExtensionLoaderChromeOs::Shutdown() { |
98 extensions::ExtensionSystem::Get(profile_)-> | 95 extensions::ExtensionSystem::Get(profile_)-> |
99 event_router()->UnregisterObserver(this); | 96 event_router()->UnregisterObserver(this); |
100 } | 97 } |
101 | 98 |
102 bool TtsExtensionLoaderChromeOs::IsTtsLoadedInThisProfile() { | 99 bool TtsExtensionLoaderChromeOs::IsTtsLoadedInThisProfile() { |
103 extensions::ExtensionSystem* system = | 100 extensions::ExtensionSystem* system = |
(...skipping 20 matching lines...) Expand all Loading... |
124 | 121 |
125 if (!IsTtsLoadedInThisProfile()) | 122 if (!IsTtsLoadedInThisProfile()) |
126 return; | 123 return; |
127 | 124 |
128 if (tts_state_ == TTS_LOADING) { | 125 if (tts_state_ == TTS_LOADING) { |
129 VLOG(1) << "TTS component extension loaded, retrying queued utterances."; | 126 VLOG(1) << "TTS component extension loaded, retrying queued utterances."; |
130 tts_state_ = TTS_LOADED; | 127 tts_state_ = TTS_LOADED; |
131 TtsController::GetInstance()->RetrySpeakingQueuedUtterances(); | 128 TtsController::GetInstance()->RetrySpeakingQueuedUtterances(); |
132 } | 129 } |
133 } | 130 } |
OLD | NEW |