Home | History | Annotate | Download | only in browser
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_
      6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_
      7 
      8 #include <string>
      9 
     10 #include "content/common/content_export.h"
     11 #include "content/public/common/media_stream_request.h"
     12 #include "ui/gfx/rect.h"
     13 
     14 namespace content {
     15 
     16 // The context information required by clients of the SpeechRecognitionManager
     17 // and its delegates for mapping the recognition session to other browser
     18 // elements involved with it (e.g., the page element that requested the
     19 // recognition). The manager keeps this struct attached to the recognition
     20 // session during all the session lifetime, making its contents available to
     21 // clients (In this regard, see SpeechRecognitionManager::GetSessionContext and
     22 // SpeechRecognitionManager::LookupSessionByContext methods).
     23 struct CONTENT_EXPORT SpeechRecognitionSessionContext {
     24   SpeechRecognitionSessionContext();
     25   ~SpeechRecognitionSessionContext();
     26 
     27   int render_process_id;
     28   int render_view_id;
     29   // Browser plugin guest's render view id, if this context represents a speech
     30   // recognition request from an embedder on behalf of the guest.
     31   int guest_render_view_id;
     32   int request_id;
     33 
     34   // Determines whether recognition was requested by a page element (in which
     35   // case its coordinates are passed in |element_rect|).
     36   bool requested_by_page_element;
     37 
     38   // The coordinates of the page element for placing the bubble (valid only when
     39   // |requested_by_page_element| = true).
     40   gfx::Rect element_rect;
     41 
     42   // A texual description of the context (website, extension name) that is
     43   // requesting recognition, for prompting security notifications to the user.
     44   std::string context_name;
     45 
     46   // The label for the permission request, it is used for request abortion.
     47   std::string label;
     48 
     49   // A list of devices being used by the recognition session.
     50   MediaStreamDevices devices;
     51 };
     52 
     53 }  // namespace content
     54 
     55 #endif  // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_SESSION_CONTEXT_H_
     56