OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/speech_input_extension_manager.h" | 5 #include "chrome/browser/speech/speech_input_extension_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void SpeechInputExtensionManager::InitializeFactory() { | 177 void SpeechInputExtensionManager::InitializeFactory() { |
178 Factory::Initialize(); | 178 Factory::Initialize(); |
179 } | 179 } |
180 | 180 |
181 void SpeechInputExtensionManager::Observe(int type, | 181 void SpeechInputExtensionManager::Observe(int type, |
182 const content::NotificationSource& source, | 182 const content::NotificationSource& source, |
183 const content::NotificationDetails& details) { | 183 const content::NotificationDetails& details) { |
184 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 184 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
185 ExtensionUnloaded( | 185 ExtensionUnloaded( |
186 content::Details<UnloadedExtensionInfo>(details)->extension->id()); | 186 content::Details<extensions::UnloadedExtensionInfo>(details)-> |
| 187 extension->id()); |
187 } else { | 188 } else { |
188 NOTREACHED(); | 189 NOTREACHED(); |
189 } | 190 } |
190 } | 191 } |
191 | 192 |
192 void SpeechInputExtensionManager::ShutdownOnUIThread() { | 193 void SpeechInputExtensionManager::ShutdownOnUIThread() { |
193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
194 VLOG(1) << "Profile shutting down."; | 195 VLOG(1) << "Profile shutting down."; |
195 | 196 |
196 base::AutoLock auto_lock(state_lock_); | 197 base::AutoLock auto_lock(state_lock_); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
313 | 314 |
314 base::AutoLock auto_lock(state_lock_); | 315 base::AutoLock auto_lock(state_lock_); |
315 if (state_ == kShutdown) | 316 if (state_ == kShutdown) |
316 return; | 317 return; |
317 | 318 |
318 DCHECK_EQ(state_, kStarting); | 319 DCHECK_EQ(state_, kStarting); |
319 VLOG(1) << "State changed to recording"; | 320 VLOG(1) << "State changed to recording"; |
320 state_ = kRecording; | 321 state_ = kRecording; |
321 | 322 |
322 const Extension* extension = profile_->GetExtensionService()-> | 323 const extensions::Extension* extension = profile_->GetExtensionService()-> |
323 GetExtensionById(extension_id_in_use_, true); | 324 GetExtensionById(extension_id_in_use_, true); |
324 DCHECK(extension); | 325 DCHECK(extension); |
325 | 326 |
326 bool show_notification = !profile_->GetPrefs()->GetBoolean( | 327 bool show_notification = !profile_->GetPrefs()->GetBoolean( |
327 prefs::kSpeechInputTrayNotificationShown); | 328 prefs::kSpeechInputTrayNotificationShown); |
328 | 329 |
329 if (!notification_.get()) | 330 if (!notification_.get()) |
330 notification_ = new SpeechRecognitionTrayIconController(); | 331 notification_ = new SpeechRecognitionTrayIconController(); |
331 notification_->Show(UTF8ToUTF16(extension->name()), show_notification); | 332 notification_->Show(UTF8ToUTF16(extension->name()), show_notification); |
332 | 333 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 base::Bind(&SpeechInputExtensionManager::SetInputVolumeOnUIThread, | 731 base::Bind(&SpeechInputExtensionManager::SetInputVolumeOnUIThread, |
731 this, volume)); | 732 this, volume)); |
732 } | 733 } |
733 | 734 |
734 void SpeechInputExtensionManager::SetInputVolumeOnUIThread( | 735 void SpeechInputExtensionManager::SetInputVolumeOnUIThread( |
735 float volume) { | 736 float volume) { |
736 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 737 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
737 DCHECK(notification_.get()); | 738 DCHECK(notification_.get()); |
738 notification_->SetVUMeterVolume(volume); | 739 notification_->SetVUMeterVolume(volume); |
739 } | 740 } |
OLD | NEW |