Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1417)

Unified Diff: chrome/browser/ui/app_list/start_page_service.h

Issue 676593003: Implement native speech recognition for the launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor and address review comments. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/start_page_service.h
diff --git a/chrome/browser/ui/app_list/start_page_service.h b/chrome/browser/ui/app_list/start_page_service.h
index e2a7c824d9227d7159c96b1178eb35a32544c4b5..706d773c3d8f22fbbf786b8615b1d9dd7e252967 100644
--- a/chrome/browser/ui/app_list/start_page_service.h
+++ b/chrome/browser/ui/app_list/start_page_service.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
#define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
+#include <stdint.h>
#include <vector>
#include "base/basictypes.h"
@@ -13,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
+#include "chrome/browser/ui/app_list/speech_recognizer_delegate.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/web_contents.h"
#include "ui/app_list/speech_ui_model_observer.h"
@@ -26,11 +28,13 @@ class Profile;
namespace app_list {
class RecommendedApps;
+class SpeechRecognizer;
class StartPageObserver;
// StartPageService collects data to be displayed in app list's start page
// and hosts the start page contents.
-class StartPageService : public KeyedService {
+class StartPageService : public KeyedService,
+ public SpeechRecognizerDelegate {
public:
typedef std::vector<scoped_refptr<const extensions::Extension> >
ExtensionList;
@@ -58,9 +62,18 @@ class StartPageService : public KeyedService {
RecommendedApps* recommended_apps() { return recommended_apps_.get(); }
Profile* profile() { return profile_; }
SpeechRecognitionState state() { return state_; }
- void OnSpeechResult(const base::string16& query, bool is_final);
- void OnSpeechSoundLevelChanged(int16 level);
- void OnSpeechRecognitionStateChanged(SpeechRecognitionState new_state);
+
+ // Overridden from app_list::SpeechRecognizerDelegate.
Matt Giuca 2014/11/03 02:35:52 Replace the '.' with a ':'. (Also, I prefer "app_
Anand Mistry (off Chromium) 2014/11/03 06:51:56 Done.
+ void OnSpeechResult(const base::string16& query, bool is_final) override;
+ void OnSpeechSoundLevelChanged(int16_t level) override;
+ void OnSpeechRecognitionStateChanged(
+ SpeechRecognitionState new_state) override;
+ content::WebContents* GetSpeechContents() override;
+
+ protected:
+ // Protected for testing.
+ explicit StartPageService(Profile* profile);
+ ~StartPageService() override;
private:
friend class StartPageServiceFactory;
@@ -74,9 +87,6 @@ class StartPageService : public KeyedService {
// getUserMedia() request from the web contents.
class StartPageWebContentsDelegate;
- explicit StartPageService(Profile* profile);
- ~StartPageService() override;
-
void LoadContents();
void UnloadContents();
@@ -96,6 +106,8 @@ class StartPageService : public KeyedService {
bool webui_finished_loading_;
std::vector<base::Closure> pending_webui_callbacks_;
+ scoped_refptr<SpeechRecognizer> speech_recognizer_;
+
DISALLOW_COPY_AND_ASSIGN(StartPageService);
};

Powered by Google App Engine
This is Rietveld 408576698