Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / speech / speech_recognition_manager_delegate.h
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 XWALK_RUNTIME_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
7
8 #include <string>
9
10 #include "content/public/browser/speech_recognition_event_listener.h"
11 #include "content/public/browser/speech_recognition_manager_delegate.h"
12 #include "content/public/browser/speech_recognition_session_config.h"
13
14 namespace xwalk {
15
16 // This is CrossWalk's implementation of the SpeechRecognitionManagerDelegate
17 // interface.
18 class XWalkSpeechRecognitionManagerDelegate
19     : public content::SpeechRecognitionManagerDelegate {
20  public:
21   XWalkSpeechRecognitionManagerDelegate();
22   virtual ~XWalkSpeechRecognitionManagerDelegate();
23
24  protected:
25   // SpeechRecognitionManagerDelegate methods.
26   virtual void GetDiagnosticInformation(bool* can_report_metrics,
27                                         std::string* hardware_info) OVERRIDE;
28   virtual void CheckRecognitionIsAllowed(
29       int session_id,
30       base::Callback<void(bool ask_user, bool is_allowed)> callback) OVERRIDE;
31   virtual content::SpeechRecognitionEventListener* GetEventListener() OVERRIDE;
32   virtual bool FilterProfanities(int render_process_id) OVERRIDE;
33
34  private:
35   // Checks for VIEW_TYPE_TAB_CONTENTS host in the UI thread and notifies back
36   // the result in the IO thread through |callback|.
37   static void CheckRenderViewType(
38       base::Callback<void(bool ask_user, bool is_allowed)> callback,
39       int render_process_id,
40       int render_view_id);
41
42   DISALLOW_COPY_AND_ASSIGN(XWalkSpeechRecognitionManagerDelegate);
43 };
44
45 }  // namespace xwalk
46
47 #endif  // XWALK_RUNTIME_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_