| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_APP_LIST_START_PAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 void ToggleSpeechRecognition(); | 42 void ToggleSpeechRecognition(); |
| 43 | 43 |
| 44 // They return essentially the same web contents but might return NULL when | 44 // They return essentially the same web contents but might return NULL when |
| 45 // some flag disables the feature. | 45 // some flag disables the feature. |
| 46 content::WebContents* GetStartPageContents(); | 46 content::WebContents* GetStartPageContents(); |
| 47 content::WebContents* GetSpeechRecognitionContents(); | 47 content::WebContents* GetSpeechRecognitionContents(); |
| 48 | 48 |
| 49 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } | 49 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } |
| 50 Profile* profile() { return profile_; } | 50 Profile* profile() { return profile_; } |
| 51 SpeechRecognitionState state() { return state_; } |
| 51 void OnSpeechResult(const base::string16& query, bool is_final); | 52 void OnSpeechResult(const base::string16& query, bool is_final); |
| 52 void OnSpeechSoundLevelChanged(int16 level); | 53 void OnSpeechSoundLevelChanged(int16 level); |
| 53 void OnSpeechRecognitionStateChanged(SpeechRecognitionState new_state); | 54 void OnSpeechRecognitionStateChanged(SpeechRecognitionState new_state); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 // A BrowserContextKeyedServiceFactory for this service. | 57 friend class StartPageServiceFactory; |
| 57 class Factory; | |
| 58 | 58 |
| 59 // ProfileDestroyObserver to shutdown the service on exiting. WebContents | 59 // ProfileDestroyObserver to shutdown the service on exiting. WebContents |
| 60 // depends on the profile and needs to be closed before the profile and its | 60 // depends on the profile and needs to be closed before the profile and its |
| 61 // keyed service shutdown. | 61 // keyed service shutdown. |
| 62 class ProfileDestroyObserver; | 62 class ProfileDestroyObserver; |
| 63 | 63 |
| 64 // The WebContentsDelegate implementation for the start page. This allows | 64 // The WebContentsDelegate implementation for the start page. This allows |
| 65 // getUserMedia() request from the web contents. | 65 // getUserMedia() request from the web contents. |
| 66 class StartPageWebContentsDelegate; | 66 class StartPageWebContentsDelegate; |
| 67 | 67 |
| 68 explicit StartPageService(Profile* profile); | 68 explicit StartPageService(Profile* profile); |
| 69 virtual ~StartPageService(); | 69 virtual ~StartPageService(); |
| 70 | 70 |
| 71 // BrowserContextKeyedService overrides: | 71 // BrowserContextKeyedService overrides: |
| 72 virtual void Shutdown() OVERRIDE; | 72 virtual void Shutdown() OVERRIDE; |
| 73 | 73 |
| 74 Profile* profile_; | 74 Profile* profile_; |
| 75 scoped_ptr<content::WebContents> contents_; | 75 scoped_ptr<content::WebContents> contents_; |
| 76 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; | 76 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; |
| 77 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; | 77 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; |
| 78 scoped_ptr<RecommendedApps> recommended_apps_; | 78 scoped_ptr<RecommendedApps> recommended_apps_; |
| 79 SpeechRecognitionState state_; |
| 79 ObserverList<StartPageObserver> observers_; | 80 ObserverList<StartPageObserver> observers_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 82 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace app_list | 85 } // namespace app_list |
| 85 | 86 |
| 86 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 87 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
| OLD | NEW |