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

Unified Diff: content/browser/speech/speech_recognition_manager_impl.h

Issue 10933018: Speech JavaScript API: Use the MediaStreamManager to ask for user permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address xians's comments Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognition_manager_impl.h
diff --git a/content/browser/speech/speech_recognition_manager_impl.h b/content/browser/speech/speech_recognition_manager_impl.h
index 0cd91051b842ebcc69b4543bbf146507d471ed45..abb451ed6ddde28a66dce34666f6673d3b28aede 100644
--- a/content/browser/speech/speech_recognition_manager_impl.h
+++ b/content/browser/speech/speech_recognition_manager_impl.h
@@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
+#include "content/browser/renderer_host/media/media_stream_requester.h"
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/speech_recognition_session_config.h"
@@ -23,6 +24,10 @@ class BrowserMainLoop;
class SpeechRecognitionManagerDelegate;
}
+namespace media_stream {
+class MediaStreamManager;
+}
+
namespace speech {
class SpeechRecognizer;
@@ -30,13 +35,12 @@ class SpeechRecognizer;
// This is the manager for speech recognition. It is a single instance in
// the browser process and can serve several requests. Each recognition request
// corresponds to a session, initiated via |CreateSession|.
-// In every moment the manager has at most one session capturing audio, which
-// is identified by |session_id_capturing_audio_|. However, multiple sessions
-// can live in parallel in respect of the aforementioned constraint, i.e. while
-// waiting for results.
-// This class does not handle user interface objects (bubbles, tray icon).
-// Those are managed by the delegate, which receives a copy of all sessions
-// events.
+//
+// In any moment, the manager has a single session known as the primary session,
+// |primary_session_id_|.
+// This is the session that is capturing audio, waiting for user permission,
+// etc. There may also be other, non-primary, sessions living in parallel that
+// are waiting for results but not recording audio.
//
// The SpeechRecognitionManager has the following responsibilities:
// - Handles requests received from various render views and makes sure only
@@ -130,7 +134,9 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl :
// Callback issued by the SpeechRecognitionManagerDelegate for reporting
// asynchronously the result of the CheckRecognitionIsAllowed call.
- void RecognitionAllowedCallback(int session_id, bool is_allowed);
+ void RecognitionAllowedCallback(int session_id,
+ bool ask_user,
+ bool is_allowed);
// Entry point for pushing any external event into the session handling FSM.
void DispatchEvent(int session_id, FSMEvent event);
@@ -159,7 +165,7 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl :
typedef std::map<int, Session> SessionsTable;
SessionsTable sessions_;
- int session_id_capturing_audio_;
+ int primary_session_id_;
int last_session_id_;
bool is_dispatching_event_;
scoped_ptr<content::SpeechRecognitionManagerDelegate> delegate_;
@@ -168,6 +174,9 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl :
// about this class being destroyed in the meanwhile (due to browser shutdown)
// since tasks pending on a destroyed WeakPtr are automatically discarded.
base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_;
+
+ class PermissionRequest;
+ scoped_ptr<PermissionRequest> permission_request_;
};
} // namespace speech

Powered by Google App Engine
This is Rietveld 408576698