| 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_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/speech/speech_recognition_bubble_controller.h" | 11 #include "chrome/browser/speech/speech_recognition_bubble_controller.h" |
| 12 #include "content/public/browser/speech_recognition_event_listener.h" | 12 #include "content/public/browser/speech_recognition_event_listener.h" |
| 13 #include "content/public/browser/speech_recognition_manager_delegate.h" | 13 #include "content/public/browser/speech_recognition_manager_delegate.h" |
| 14 #include "content/public/browser/speech_recognition_session_config.h" | 14 #include "content/public/browser/speech_recognition_session_config.h" |
| 15 | 15 |
| 16 class SpeechRecognitionTrayIconController; | 16 class SpeechRecognitionTrayIconController; |
| 17 class TabWatcher; |
| 17 | 18 |
| 18 namespace speech { | 19 namespace speech { |
| 19 | |
| 20 // This is Chrome's implementation of the SpeechRecognitionManagerDelegate | 20 // This is Chrome's implementation of the SpeechRecognitionManagerDelegate |
| 21 // interface. | 21 // interface. |
| 22 class ChromeSpeechRecognitionManagerDelegate | 22 class ChromeSpeechRecognitionManagerDelegate |
| 23 : NON_EXPORTED_BASE(public content::SpeechRecognitionManagerDelegate), | 23 : NON_EXPORTED_BASE(public content::SpeechRecognitionManagerDelegate), |
| 24 public content::SpeechRecognitionEventListener, | 24 public content::SpeechRecognitionEventListener, |
| 25 public SpeechRecognitionBubbleControllerDelegate { | 25 public SpeechRecognitionBubbleControllerDelegate { |
| 26 public: | 26 public: |
| 27 ChromeSpeechRecognitionManagerDelegate(); | 27 ChromeSpeechRecognitionManagerDelegate(); |
| 28 virtual ~ChromeSpeechRecognitionManagerDelegate(); | 28 virtual ~ChromeSpeechRecognitionManagerDelegate(); |
| 29 | 29 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 static void CheckRenderViewType( | 73 static void CheckRenderViewType( |
| 74 int session_id, | 74 int session_id, |
| 75 base::Callback<void(int session_id, bool is_allowed)> callback, | 75 base::Callback<void(int session_id, bool is_allowed)> callback, |
| 76 int render_process_id, | 76 int render_process_id, |
| 77 int render_view_id); | 77 int render_view_id); |
| 78 | 78 |
| 79 // Starts a new recognition session, using the config of the last one | 79 // Starts a new recognition session, using the config of the last one |
| 80 // (which is copied into |last_session_config_|). Used for "try again". | 80 // (which is copied into |last_session_config_|). Used for "try again". |
| 81 void RestartLastSession(); | 81 void RestartLastSession(); |
| 82 | 82 |
| 83 // Callback called by |tab_watcher_| on the IO thread to signal tab closure. |
| 84 void TabClosedCallback(int render_process_id, int render_view_id); |
| 85 |
| 83 // Lazy initializers for bubble and tray icon controller. | 86 // Lazy initializers for bubble and tray icon controller. |
| 84 SpeechRecognitionBubbleController* GetBubbleController(); | 87 SpeechRecognitionBubbleController* GetBubbleController(); |
| 85 SpeechRecognitionTrayIconController* GetTrayIconController(); | 88 SpeechRecognitionTrayIconController* GetTrayIconController(); |
| 86 | 89 |
| 87 scoped_refptr<SpeechRecognitionBubbleController> bubble_controller_; | 90 scoped_refptr<SpeechRecognitionBubbleController> bubble_controller_; |
| 88 scoped_refptr<SpeechRecognitionTrayIconController> tray_icon_controller_; | 91 scoped_refptr<SpeechRecognitionTrayIconController> tray_icon_controller_; |
| 89 scoped_refptr<OptionalRequestInfo> optional_request_info_; | 92 scoped_refptr<OptionalRequestInfo> optional_request_info_; |
| 90 scoped_ptr<content::SpeechRecognitionSessionConfig> last_session_config_; | 93 scoped_ptr<content::SpeechRecognitionSessionConfig> last_session_config_; |
| 91 | 94 scoped_refptr<TabWatcher> tab_watcher_; |
| 92 // TODO(primiano) this information should be kept into the bubble_controller_. | |
| 93 int active_bubble_session_id_; | |
| 94 | 95 |
| 95 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate); | 96 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate); |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace speech | 99 } // namespace speech |
| 99 | 100 |
| 100 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 101 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| OLD | NEW |