Chromium Code Reviews| 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 #ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/common/media_stream_request.h" | 11 #include "content/public/common/media_stream_request.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class RenderFrameHost; | |
| 17 | |
| 16 // The context information required by clients of the SpeechRecognitionManager | 18 // The context information required by clients of the SpeechRecognitionManager |
| 17 // and its delegates for mapping the recognition session to other browser | 19 // and its delegates for mapping the recognition session to other browser |
| 18 // elements involved with it (e.g., the page element that requested the | 20 // elements involved with it (e.g., the page element that requested the |
| 19 // recognition). The manager keeps this struct attached to the recognition | 21 // recognition). The manager keeps this struct attached to the recognition |
| 20 // session during all the session lifetime, making its contents available to | 22 // session during all the session lifetime, making its contents available to |
| 21 // clients (In this regard, see SpeechRecognitionManager::GetSessionContext and | 23 // clients (In this regard, see SpeechRecognitionManager::GetSessionContext and |
| 22 // SpeechRecognitionManager::LookupSessionByContext methods). | 24 // SpeechRecognitionManager::LookupSessionByContext methods). |
| 23 struct CONTENT_EXPORT SpeechRecognitionSessionContext { | 25 struct CONTENT_EXPORT SpeechRecognitionSessionContext { |
| 24 SpeechRecognitionSessionContext(); | 26 SpeechRecognitionSessionContext(); |
| 25 ~SpeechRecognitionSessionContext(); | 27 ~SpeechRecognitionSessionContext(); |
| 26 | 28 |
| 27 int render_process_id; | 29 // This could be { render_process_id, render_frame_id } but getting a |
| 28 int render_view_id; | 30 // RenderFrameHost* from those must be done on the UI thread which makes it |
| 29 int render_frame_id; | 31 // really inconvenient. Instead, SpeechRecognitionDispatcherHost informs the |
|
Charlie Reis
2014/11/11 04:37:31
This is unsafe. RenderFrameHost itself cannot be
| |
| 32 // SpeechRecognitionManager when a RenderFrameHost has been killed so the | |
| 33 // associated SpeechRecognitionSessionContext can be deleted. | |
| 34 RenderFrameHost* render_frame_host; | |
| 30 | 35 |
| 31 // Browser plugin guest's render view id, if this context represents a speech | 36 // Browser plugin guest's render frame id, if this context represents a speech |
| 32 // recognition request from an embedder on behalf of the guest. This is used | 37 // recognition request from an embedder on behalf of the guest. This is used |
| 33 // for input tag where speech bubble is to be shown. | 38 // for input tag where speech bubble is to be shown. |
| 34 // | 39 // |
| 35 // TODO(lazyboy): Right now showing bubble from guest does not work, we fall | 40 // TODO(lazyboy): Right now showing bubble from guest does not work, we fall |
| 36 // back to embedder instead, fix this and use | 41 // back to embedder instead, fix this and use |
| 37 // embedder_render_process_id/embedder_render_view_id similar to Web Speech | 42 // embedder_render_process_id/embedder_render_frame_id similar to Web Speech |
| 38 // API below. | 43 // API below. |
| 39 int guest_render_view_id; | 44 int guest_render_frame_id; |
| 40 | 45 |
| 41 // The pair (|embedder_render_process_id|, |embedder_render_view_id|) | 46 // The pair (|embedder_render_process_id|, |embedder_render_frame_id|) |
| 42 // represents a Browser plugin guest's embedder. This is filled in if the | 47 // represents a Browser plugin guest's embedder. This is filled in if the |
| 43 // session is from a guest Web Speech API. We use these to check if the | 48 // session is from a guest Web Speech API. We use these to check if the |
| 44 // embedder (app) is permitted to use audio. | 49 // embedder (app) is permitted to use audio. |
| 45 int embedder_render_process_id; | 50 int embedder_render_process_id; |
| 46 int embedder_render_view_id; | 51 int embedder_render_frame_id; |
| 47 | 52 |
| 48 int request_id; | 53 int request_id; |
| 49 | 54 |
| 50 // A texual description of the context (website, extension name) that is | 55 // A texual description of the context (website, extension name) that is |
| 51 // requesting recognition, for prompting security notifications to the user. | 56 // requesting recognition, for prompting security notifications to the user. |
| 52 std::string context_name; | 57 std::string context_name; |
| 53 | 58 |
| 54 // The label for the permission request, it is used for request abortion. | 59 // The label for the permission request, it is used for request abortion. |
| 55 std::string label; | 60 std::string label; |
| 56 | 61 |
| 57 // A list of devices being used by the recognition session. | 62 // A list of devices being used by the recognition session. |
| 58 MediaStreamDevices devices; | 63 MediaStreamDevices devices; |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace content | 66 } // namespace content |
| 62 | 67 |
| 63 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ | 68 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_ |
| OLD | NEW |