Index: chrome/browser/speech/speech_input_extension_manager.cc |
diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc |
index 93c4a80a184c7d1d9b6e6a78846066eaef20e59b..fba7b9e0edf907fb7e4c94a0be658023607c1a9d 100644 |
--- a/chrome/browser/speech/speech_input_extension_manager.cc |
+++ b/chrome/browser/speech/speech_input_extension_manager.cc |
@@ -283,9 +283,9 @@ void SpeechInputExtensionManager::SetRecognitionResultOnUIThread( |
const std::string& extension_id) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- ListValue args; |
+ ListValue* args = new ListValue(); |
DictionaryValue* js_event = new DictionaryValue(); |
- args.Append(js_event); |
+ args->Append(js_event); |
ListValue* js_hypothesis_array = new ListValue(); |
js_event->Set(kHypothesesKey, js_hypothesis_array); |
@@ -302,10 +302,7 @@ void SpeechInputExtensionManager::SetRecognitionResultOnUIThread( |
hypothesis.confidence); |
} |
- std::string json_args; |
- base::JSONWriter::Write(&args, &json_args); |
- VLOG(1) << "Results: " << json_args; |
- DispatchEventToExtension(extension_id, kOnResultEvent, json_args); |
+ DispatchEventToExtension(extension_id, kOnResultEvent, args); |
} |
void SpeechInputExtensionManager::OnRecognitionStart(int session_id) { |
@@ -433,27 +430,25 @@ void SpeechInputExtensionManager::OnSoundStart(int session_id) { |
DCHECK_EQ(session_id, speech_recognition_session_id_); |
VLOG(1) << "OnSoundStart"; |
- std::string json_args; |
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
base::Bind(&SpeechInputExtensionManager::DispatchEventToExtension, |
this, extension_id_in_use_, std::string(kOnSoundStartEvent), |
- json_args)); |
+ new ListValue())); |
miket_OOO
2012/07/10 22:33:19
Would NULL work here? (I honestly don't know, but
|
} |
void SpeechInputExtensionManager::OnSoundEnd(int session_id) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
VLOG(1) << "OnSoundEnd"; |
- std::string json_args; |
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
base::Bind(&SpeechInputExtensionManager::DispatchEventToExtension, |
this, extension_id_in_use_, std::string(kOnSoundEndEvent), |
- json_args)); |
+ new ListValue())); |
} |
void SpeechInputExtensionManager::DispatchEventToExtension( |
const std::string& extension_id, const std::string& event, |
- const std::string& json_args) { |
+ ListValue* event_args) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
base::AutoLock auto_lock(state_lock_); |
@@ -461,16 +456,8 @@ void SpeechInputExtensionManager::DispatchEventToExtension( |
return; |
if (profile_ && profile_->GetExtensionEventRouter()) { |
- std::string final_args; |
- if (json_args.empty()) { |
- ListValue args; |
- base::JSONWriter::Write(&args, &final_args); |
- } else { |
- final_args = json_args; |
- } |
- |
profile_->GetExtensionEventRouter()->DispatchEventToExtension( |
- extension_id, event, final_args, profile_, GURL()); |
+ extension_id, event, event_args, profile_, GURL()); |
} |
} |
@@ -497,14 +484,11 @@ void SpeechInputExtensionManager::DispatchError( |
// Used for errors that are also reported via the onError event. |
if (dispatch_event) { |
- ListValue args; |
+ ListValue* args = new ListValue(); |
DictionaryValue* js_error = new DictionaryValue(); |
- args.Append(js_error); |
+ args->Append(js_error); |
js_error->SetString(kErrorCodeKey, error); |
- std::string json_args; |
- base::JSONWriter::Write(&args, &json_args); |
- DispatchEventToExtension(extension_id, |
- kOnErrorEvent, json_args); |
+ DispatchEventToExtension(extension_id, kOnErrorEvent, args); |
} |
} |