| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace extensions { | 32 namespace extensions { |
| 33 class Extension; | 33 class Extension; |
| 34 } | 34 } |
| 35 | 35 |
| 36 class Profile; | 36 class Profile; |
| 37 | 37 |
| 38 namespace app_list { | 38 namespace app_list { |
| 39 | 39 |
| 40 class RecommendedApps; | |
| 41 class SpeechAuthHelper; | 40 class SpeechAuthHelper; |
| 42 class SpeechRecognizer; | 41 class SpeechRecognizer; |
| 43 class StartPageObserver; | 42 class StartPageObserver; |
| 44 | 43 |
| 45 // StartPageService collects data to be displayed in app list's start page | 44 // StartPageService collects data to be displayed in app list's start page |
| 46 // and hosts the start page contents. | 45 // and hosts the start page contents. |
| 47 class StartPageService : public KeyedService, | 46 class StartPageService : public KeyedService, |
| 48 public content::WebContentsObserver, | 47 public content::WebContentsObserver, |
| 49 public SpeechRecognizerDelegate { | 48 public SpeechRecognizerDelegate { |
| 50 public: | 49 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 65 void WebUILoaded(); | 64 void WebUILoaded(); |
| 66 | 65 |
| 67 // Returns true if the hotword is enabled in the app-launcher. | 66 // Returns true if the hotword is enabled in the app-launcher. |
| 68 bool HotwordEnabled(); | 67 bool HotwordEnabled(); |
| 69 | 68 |
| 70 // They return essentially the same web contents but might return NULL when | 69 // They return essentially the same web contents but might return NULL when |
| 71 // some flag disables the feature. | 70 // some flag disables the feature. |
| 72 content::WebContents* GetStartPageContents(); | 71 content::WebContents* GetStartPageContents(); |
| 73 content::WebContents* GetSpeechRecognitionContents(); | 72 content::WebContents* GetSpeechRecognitionContents(); |
| 74 | 73 |
| 75 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } | |
| 76 Profile* profile() { return profile_; } | 74 Profile* profile() { return profile_; } |
| 77 SpeechRecognitionState state() { return state_; } | 75 SpeechRecognitionState state() { return state_; } |
| 78 | 76 |
| 79 // Overridden from app_list::SpeechRecognizerDelegate: | 77 // Overridden from app_list::SpeechRecognizerDelegate: |
| 80 void OnSpeechResult(const base::string16& query, bool is_final) override; | 78 void OnSpeechResult(const base::string16& query, bool is_final) override; |
| 81 void OnSpeechSoundLevelChanged(int16_t level) override; | 79 void OnSpeechSoundLevelChanged(int16_t level) override; |
| 82 void OnSpeechRecognitionStateChanged( | 80 void OnSpeechRecognitionStateChanged( |
| 83 SpeechRecognitionState new_state) override; | 81 SpeechRecognitionState new_state) override; |
| 84 void GetSpeechAuthParameters(std::string* auth_scope, | 82 void GetSpeechAuthParameters(std::string* auth_scope, |
| 85 std::string* auth_token) override; | 83 std::string* auth_token) override; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Change the known network connectivity state. |available| should be true if | 126 // Change the known network connectivity state. |available| should be true if |
| 129 // at least one network is connected to. | 127 // at least one network is connected to. |
| 130 void OnNetworkChanged(bool available); | 128 void OnNetworkChanged(bool available); |
| 131 // Enables/disables voice recognition based on network and microphone state. | 129 // Enables/disables voice recognition based on network and microphone state. |
| 132 void UpdateRecognitionState(); | 130 void UpdateRecognitionState(); |
| 133 | 131 |
| 134 Profile* profile_; | 132 Profile* profile_; |
| 135 scoped_ptr<content::WebContents> contents_; | 133 scoped_ptr<content::WebContents> contents_; |
| 136 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; | 134 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; |
| 137 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; | 135 scoped_ptr<ProfileDestroyObserver> profile_destroy_observer_; |
| 138 scoped_ptr<RecommendedApps> recommended_apps_; | |
| 139 SpeechRecognitionState state_; | 136 SpeechRecognitionState state_; |
| 140 ObserverList<StartPageObserver> observers_; | 137 ObserverList<StartPageObserver> observers_; |
| 141 bool speech_button_toggled_manually_; | 138 bool speech_button_toggled_manually_; |
| 142 bool speech_result_obtained_; | 139 bool speech_result_obtained_; |
| 143 | 140 |
| 144 bool webui_finished_loading_; | 141 bool webui_finished_loading_; |
| 145 std::vector<base::Closure> pending_webui_callbacks_; | 142 std::vector<base::Closure> pending_webui_callbacks_; |
| 146 | 143 |
| 147 base::DefaultClock clock_; | 144 base::DefaultClock clock_; |
| 148 scoped_ptr<SpeechRecognizer> speech_recognizer_; | 145 scoped_ptr<SpeechRecognizer> speech_recognizer_; |
| 149 scoped_ptr<SpeechAuthHelper> speech_auth_helper_; | 146 scoped_ptr<SpeechAuthHelper> speech_auth_helper_; |
| 150 | 147 |
| 151 bool network_available_; | 148 bool network_available_; |
| 152 bool microphone_available_; | 149 bool microphone_available_; |
| 153 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
| 154 scoped_ptr<AudioStatus> audio_status_; | 151 scoped_ptr<AudioStatus> audio_status_; |
| 155 #endif | 152 #endif |
| 156 scoped_ptr<NetworkChangeObserver> network_change_observer_; | 153 scoped_ptr<NetworkChangeObserver> network_change_observer_; |
| 157 | 154 |
| 158 base::WeakPtrFactory<StartPageService> weak_factory_; | 155 base::WeakPtrFactory<StartPageService> weak_factory_; |
| 159 | 156 |
| 160 DISALLOW_COPY_AND_ASSIGN(StartPageService); | 157 DISALLOW_COPY_AND_ASSIGN(StartPageService); |
| 161 }; | 158 }; |
| 162 | 159 |
| 163 } // namespace app_list | 160 } // namespace app_list |
| 164 | 161 |
| 165 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ | 162 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ |
| OLD | NEW |