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

Side by Side Diff: chrome/browser/speech/speech_input_extension_manager.cc

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
447 VLOG(1) << "OnSoundEnd"; 447 VLOG(1) << "OnSoundEnd";
448 448
449 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 449 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
450 base::Bind(&SpeechInputExtensionManager::DispatchEventToExtension, 450 base::Bind(&SpeechInputExtensionManager::DispatchEventToExtension,
451 this, extension_id_in_use_, std::string(kOnSoundEndEvent), 451 this, extension_id_in_use_, std::string(kOnSoundEndEvent),
452 Passed(scoped_ptr<ListValue>(new ListValue())))); 452 Passed(scoped_ptr<ListValue>(new ListValue()))));
453 } 453 }
454 454
455 void SpeechInputExtensionManager::DispatchEventToExtension( 455 void SpeechInputExtensionManager::DispatchEventToExtension(
456 const std::string& extension_id, const std::string& event, 456 const std::string& extension_id, const std::string& event_name,
tommi (sloooow) - chröme 2012/12/06 14:26:01 update the header as well?
457 scoped_ptr<ListValue> event_args) { 457 scoped_ptr<ListValue> event_args) {
458 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 458 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
459 459
460 base::AutoLock auto_lock(state_lock_); 460 base::AutoLock auto_lock(state_lock_);
461 if (state_ == kShutdown) 461 if (state_ == kShutdown)
462 return; 462 return;
463 463
464 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) { 464 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
465 scoped_ptr<extensions::Event> event(new extensions::Event(
466 event_name, event_args.Pass()));
467 event->restrict_to_profile = profile_;
465 extensions::ExtensionSystem::Get(profile_)->event_router()-> 468 extensions::ExtensionSystem::Get(profile_)->event_router()->
466 DispatchEventToExtension(extension_id, event, event_args.Pass(), 469 DispatchEventToExtension(extension_id, event.Pass());
467 profile_, GURL());
468 } 470 }
469 } 471 }
470 472
471 void SpeechInputExtensionManager::DispatchError( 473 void SpeechInputExtensionManager::DispatchError(
472 const std::string& error, bool dispatch_event) { 474 const std::string& error, bool dispatch_event) {
473 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
474 476
475 std::string extension_id; 477 std::string extension_id;
476 { 478 {
477 base::AutoLock auto_lock(state_lock_); 479 base::AutoLock auto_lock(state_lock_);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 content::NotificationService::current()->Notify( 758 content::NotificationService::current()->Notify(
757 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED, 759 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED,
758 // Guarded by the state_ == kShutdown check. 760 // Guarded by the state_ == kShutdown check.
759 content::Source<Profile>(profile_), 761 content::Source<Profile>(profile_),
760 content::Details<std::string>(&extension_id)); 762 content::Details<std::string>(&extension_id));
761 } 763 }
762 764
763 void SpeechInputExtensionManager::OnAudioLevelsChange(int session_id, 765 void SpeechInputExtensionManager::OnAudioLevelsChange(int session_id,
764 float volume, 766 float volume,
765 float noise_volume) {} 767 float noise_volume) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698