| 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 CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Invoked when the user clicks outside the speech recognition info bubble | 43 // Invoked when the user clicks outside the speech recognition info bubble |
| 44 // causing it to close and input focus to change. | 44 // causing it to close and input focus to change. |
| 45 virtual void InfoBubbleFocusChanged(int session_id) = 0; | 45 virtual void InfoBubbleFocusChanged(int session_id) = 0; |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 virtual ~Delegate() {} | 48 virtual ~Delegate() {} |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 explicit SpeechRecognitionBubbleController(Delegate* delegate); | 51 explicit SpeechRecognitionBubbleController(Delegate* delegate); |
| 52 virtual ~SpeechRecognitionBubbleController(); | |
| 53 | 52 |
| 54 // Creates a new speech recognition UI bubble. One of the SetXxxx methods | 53 // Creates a new speech recognition UI bubble. One of the SetXxxx methods |
| 55 // below need to be called to specify what to display. | 54 // below need to be called to specify what to display. |
| 56 void CreateBubble(int session_id, | 55 void CreateBubble(int session_id, |
| 57 int render_process_id, | 56 int render_process_id, |
| 58 int render_view_id, | 57 int render_view_id, |
| 59 const gfx::Rect& element_rect); | 58 const gfx::Rect& element_rect); |
| 60 | 59 |
| 61 // Indicates to the user that audio hardware is warming up. This also makes | 60 // Indicates to the user that audio hardware is warming up. This also makes |
| 62 // the bubble visible if not already visible. | 61 // the bubble visible if not already visible. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 83 virtual void InfoBubbleButtonClicked( | 82 virtual void InfoBubbleButtonClicked( |
| 84 SpeechRecognitionBubble::Button button) OVERRIDE; | 83 SpeechRecognitionBubble::Button button) OVERRIDE; |
| 85 virtual void InfoBubbleFocusChanged() OVERRIDE; | 84 virtual void InfoBubbleFocusChanged() OVERRIDE; |
| 86 | 85 |
| 87 // content::NotificationObserver implementation. | 86 // content::NotificationObserver implementation. |
| 88 virtual void Observe(int type, | 87 virtual void Observe(int type, |
| 89 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
| 90 const content::NotificationDetails& details) OVERRIDE; | 89 const content::NotificationDetails& details) OVERRIDE; |
| 91 | 90 |
| 92 private: | 91 private: |
| 92 friend class base::RefCountedThreadSafe<SpeechRecognitionBubbleController>; |
| 93 |
| 93 // The various calls received by this object and handled in the UI thread. | 94 // The various calls received by this object and handled in the UI thread. |
| 94 enum RequestType { | 95 enum RequestType { |
| 95 REQUEST_SET_WARM_UP_MODE, | 96 REQUEST_SET_WARM_UP_MODE, |
| 96 REQUEST_SET_RECORDING_MODE, | 97 REQUEST_SET_RECORDING_MODE, |
| 97 REQUEST_SET_RECOGNIZING_MODE, | 98 REQUEST_SET_RECOGNIZING_MODE, |
| 98 REQUEST_SET_MESSAGE, | 99 REQUEST_SET_MESSAGE, |
| 99 REQUEST_SET_INPUT_VOLUME, | 100 REQUEST_SET_INPUT_VOLUME, |
| 100 REQUEST_CLOSE, | 101 REQUEST_CLOSE, |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 enum ManageSubscriptionAction { | 104 enum ManageSubscriptionAction { |
| 104 BUBBLE_ADDED, | 105 BUBBLE_ADDED, |
| 105 BUBBLE_REMOVED | 106 BUBBLE_REMOVED |
| 106 }; | 107 }; |
| 107 | 108 |
| 109 virtual ~SpeechRecognitionBubbleController(); |
| 110 |
| 108 void InvokeDelegateButtonClicked(int session_id, | 111 void InvokeDelegateButtonClicked(int session_id, |
| 109 SpeechRecognitionBubble::Button button); | 112 SpeechRecognitionBubble::Button button); |
| 110 void InvokeDelegateFocusChanged(int session_id); | 113 void InvokeDelegateFocusChanged(int session_id); |
| 111 void ProcessRequestInUiThread(int session_id, | 114 void ProcessRequestInUiThread(int session_id, |
| 112 RequestType type, | 115 RequestType type, |
| 113 const string16& text, | 116 const string16& text, |
| 114 float volume, | 117 float volume, |
| 115 float noise_volume); | 118 float noise_volume); |
| 116 | 119 |
| 117 // Called whenever a bubble was added to or removed from the list. If the | 120 // Called whenever a bubble was added to or removed from the list. If the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 142 // This typedef is to workaround the issue with certain versions of | 145 // This typedef is to workaround the issue with certain versions of |
| 143 // Visual Studio where it gets confused between multiple Delegate | 146 // Visual Studio where it gets confused between multiple Delegate |
| 144 // classes and gives a C2500 error. (I saw this error on the try bots - | 147 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 145 // the workaround was not needed for my machine). | 148 // the workaround was not needed for my machine). |
| 146 typedef SpeechRecognitionBubbleController::Delegate | 149 typedef SpeechRecognitionBubbleController::Delegate |
| 147 SpeechRecognitionBubbleControllerDelegate; | 150 SpeechRecognitionBubbleControllerDelegate; |
| 148 | 151 |
| 149 } // namespace speech | 152 } // namespace speech |
| 150 | 153 |
| 151 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ | 154 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |