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_MANAGER_DELEGATE_H_
      6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
      7 
      8 #include <string>
      9 
     10 #include "base/callback_forward.h"
     11 #include "content/public/common/speech_recognition_error.h"
     12 
     13 namespace content {
     14 
     15 class SpeechRecognitionEventListener;
     16 struct SpeechRecognitionResult;
     17 
     18 // Allows embedders to display the current state of recognition, for getting the
     19 // user's permission and for fetching optional request information.
     20 class SpeechRecognitionManagerDelegate {
     21  public:
     22   virtual ~SpeechRecognitionManagerDelegate() {}
     23 
     24   // Get the optional diagnostic hardware information if available.
     25   // This is called on the IO thread.
     26   virtual void GetDiagnosticInformation(bool* can_report_metrics,
     27                                         std::string* hardware_info) = 0;
     28 
     29   // Checks (asynchronously) if current setup allows speech recognition.
     30   // This is called on the IO thread.
     31   virtual void CheckRecognitionIsAllowed(
     32       int session_id,
     33       base::Callback<void(bool ask_user, bool is_allowed)> callback) = 0;
     34 
     35   // Checks whether the delegate is interested (returning a non NULL ptr) or not
     36   // (returning NULL) in receiving a copy of all sessions events.
     37   // This is called on the IO thread.
     38   virtual SpeechRecognitionEventListener* GetEventListener() = 0;
     39 
     40   // Checks whether the speech recognition for the given renderer should filter
     41   // profanities or not.
     42   virtual bool FilterProfanities(int render_process_id) = 0;
     43 };
     44 
     45 }  // namespace content
     46 
     47 #endif  // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
     48