OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ |
6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ | 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "chrome/browser/speech/speech_input_bubble_controller.h" | 10 #include "chrome/browser/speech/speech_input_bubble_controller.h" |
11 #include "content/browser/speech/speech_input_manager.h" | 11 #include "content/browser/speech/speech_input_manager.h" |
12 | 12 |
13 namespace speech_input { | 13 namespace speech_input { |
14 | 14 |
15 // This is Chrome's implementation of the SpeechInputManager interface. This | 15 // This is Chrome's implementation of the SpeechInputManager interface. This |
16 // class is a singleton and accessed via the Get method. | 16 // class is a singleton and accessed via the Get method. |
17 class ChromeSpeechInputManager : public SpeechInputManager, | 17 class ChromeSpeechInputManager : public SpeechInputManager, |
18 public SpeechInputBubbleControllerDelegate { | 18 public SpeechInputBubbleControllerDelegate { |
19 public: | 19 public: |
20 static ChromeSpeechInputManager* GetInstance(); | 20 static ChromeSpeechInputManager* GetInstance(); |
21 | 21 |
22 // SpeechInputBubbleController::Delegate methods. | 22 // SpeechInputBubbleController::Delegate methods. |
23 virtual void InfoBubbleButtonClicked(int caller_id, | 23 virtual void InfoBubbleButtonClicked(int caller_id, |
24 SpeechInputBubble::Button button); | 24 SpeechInputBubble::Button button) |
25 virtual void InfoBubbleFocusChanged(int caller_id); | 25 OVERRIDE; |
| 26 virtual void InfoBubbleFocusChanged(int caller_id) OVERRIDE; |
26 | 27 |
27 protected: | 28 protected: |
28 // SpeechInputManager methods. | 29 // SpeechInputManager methods. |
29 virtual void GetRequestInfo(bool* can_report_metrics, | 30 virtual void GetRequestInfo(bool* can_report_metrics, |
30 std::string* request_info); | 31 std::string* request_info) OVERRIDE; |
31 virtual void ShowRecognitionRequested(int caller_id, | 32 virtual void ShowRecognitionRequested(int caller_id, |
32 int render_process_id, | 33 int render_process_id, |
33 int render_view_id, | 34 int render_view_id, |
34 const gfx::Rect& element_rect); | 35 const gfx::Rect& element_rect) OVERRIDE; |
35 virtual void ShowWarmUp(int caller_id); | 36 virtual void ShowWarmUp(int caller_id) OVERRIDE; |
36 virtual void ShowRecognizing(int caller_id); | 37 virtual void ShowRecognizing(int caller_id) OVERRIDE; |
37 virtual void ShowRecording(int caller_id); | 38 virtual void ShowRecording(int caller_id) OVERRIDE; |
38 virtual void ShowInputVolume(int caller_id, | 39 virtual void ShowInputVolume(int caller_id, |
39 float volume, | 40 float volume, |
40 float noise_volume); | 41 float noise_volume) OVERRIDE; |
41 virtual void ShowNoMicError(int caller_id); | 42 virtual void ShowNoMicError(int caller_id) OVERRIDE; |
42 virtual void ShowRecognizerError(int caller_id, | 43 virtual void ShowRecognizerError(int caller_id, |
43 SpeechRecognizer::ErrorCode error); | 44 SpeechInputError error) OVERRIDE; |
44 virtual void DoClose(int caller_id); | 45 virtual void DoClose(int caller_id) OVERRIDE; |
45 | 46 |
46 private: | 47 private: |
47 class OptionalRequestInfo; | 48 class OptionalRequestInfo; |
48 | 49 |
49 // Private constructor to enforce singleton. | 50 // Private constructor to enforce singleton. |
50 friend struct DefaultSingletonTraits<ChromeSpeechInputManager>; | 51 friend struct DefaultSingletonTraits<ChromeSpeechInputManager>; |
51 ChromeSpeechInputManager(); | 52 ChromeSpeechInputManager(); |
52 virtual ~ChromeSpeechInputManager(); | 53 virtual ~ChromeSpeechInputManager(); |
53 | 54 |
54 scoped_refptr<SpeechInputBubbleController> bubble_controller_; | 55 scoped_refptr<SpeechInputBubbleController> bubble_controller_; |
55 scoped_refptr<OptionalRequestInfo> optional_request_info_; | 56 scoped_refptr<OptionalRequestInfo> optional_request_info_; |
56 | 57 |
57 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputManager); | 58 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputManager); |
58 }; | 59 }; |
59 | 60 |
60 } // namespace speech_input | 61 } // namespace speech_input |
61 | 62 |
62 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ | 63 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_ |
OLD | NEW |