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

Side by Side Diff: Source/modules/speech/SpeechRecognition.cpp

Issue 1117383002: Changing serviceuri param to be url from string in Blink and tagging requests to speech recognizer Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing compile errors Created 5 years, 7 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include "modules/speech/SpeechRecognition.h" 28 #include "modules/speech/SpeechRecognition.h"
29 29
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/page/Page.h" 33 #include "core/page/Page.h"
34 #include "modules/mediastream/MediaStreamTrack.h" 34 #include "modules/mediastream/MediaStreamTrack.h"
35 #include "modules/speech/SpeechRecognitionController.h" 35 #include "modules/speech/SpeechRecognitionController.h"
36 #include "modules/speech/SpeechRecognitionError.h" 36 #include "modules/speech/SpeechRecognitionError.h"
37 #include "modules/speech/SpeechRecognitionEvent.h" 37 #include "modules/speech/SpeechRecognitionEvent.h"
38 #include "platform/weborigin/KURL.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 SpeechRecognition* SpeechRecognition::create(ExecutionContext* context) 42 SpeechRecognition* SpeechRecognition::create(ExecutionContext* context)
42 { 43 {
43 ASSERT(context && context->isDocument()); 44 ASSERT(context && context->isDocument());
44 Document* document = toDocument(context); 45 Document* document = toDocument(context);
45 ASSERT(document); 46 ASSERT(document);
46 SpeechRecognition* speechRecognition = new SpeechRecognition(document->page( ), context); 47 SpeechRecognition* speechRecognition = new SpeechRecognition(document->page( ), context);
47 speechRecognition->suspendIfNeeded(); 48 speechRecognition->suspendIfNeeded();
48 return speechRecognition; 49 return speechRecognition;
49 } 50 }
50 51
51 void SpeechRecognition::start(ExceptionState& exceptionState) 52 void SpeechRecognition::start(ExceptionState& exceptionState)
52 { 53 {
53 if (!m_controller) 54 if (!m_controller)
54 return; 55 return;
55 56
56 if (m_started) { 57 if (m_started) {
57 exceptionState.throwDOMException(InvalidStateError, "recognition has alr eady started."); 58 exceptionState.throwDOMException(InvalidStateError, "recognition has alr eady started.");
58 return; 59 return;
59 } 60 }
60 61
62 KURL url(ParsedURLString, m_serviceURI);
63 // Throw an error if serviceuri is not empty and url is invalid.
64 if (!m_serviceURI.isEmpty() && !url.isValid()) {
65 exceptionState.throwDOMException(SyntaxError, "serviceuri is invalid");
jochen (gone - plz use gerrit) 2015/05/05 13:57:53 the attribute is "serviceURI". also, please add a
kirtia 2015/05/05 23:12:29 Done.
66 return;
67 }
68
61 m_finalResults.clear(); 69 m_finalResults.clear();
62 m_controller->start(this, m_grammars, m_lang, m_serviceURI, m_continuous, m_ interimResults, m_maxAlternatives, m_audioTrack); 70 m_controller->start(this, m_grammars, m_lang, url, m_continuous, m_interimRe sults, m_maxAlternatives, m_audioTrack);
63 m_started = true; 71 m_started = true;
64 } 72 }
65 73
66 void SpeechRecognition::stopFunction() 74 void SpeechRecognition::stopFunction()
67 { 75 {
68 if (!m_controller) 76 if (!m_controller)
69 return; 77 return;
70 78
71 if (m_started && !m_stopping) { 79 if (m_started && !m_stopping) {
72 m_stopping = true; 80 m_stopping = true;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 #if ENABLE(OILPAN) 216 #if ENABLE(OILPAN)
209 visitor->trace(m_controller); 217 visitor->trace(m_controller);
210 #endif 218 #endif
211 visitor->trace(m_finalResults); 219 visitor->trace(m_finalResults);
212 RefCountedGarbageCollectedEventTargetWithInlineData<SpeechRecognition>::trac e(visitor); 220 RefCountedGarbageCollectedEventTargetWithInlineData<SpeechRecognition>::trac e(visitor);
213 PageLifecycleObserver::trace(visitor); 221 PageLifecycleObserver::trace(visitor);
214 ActiveDOMObject::trace(visitor); 222 ActiveDOMObject::trace(visitor);
215 } 223 }
216 224
217 } // namespace blink 225 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/speech/SpeechRecognitionClient.h » ('j') | Source/modules/speech/SpeechRecognitionController.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698